WP Code Generator

What the WP Code Generator does for WordPress 7.x: 33 generators, 40 snippets, files in tabs, ZIP download, and shared fields — your starting point.

Boilerplate for WordPress 7.x, without the typos

The WP Code Generator produces ready-to-use, modern PHP, JSON, and JavaScript for WordPress 7.0 and 7.1 on PHP 8.3: plugin scaffolds including readme.txt, theme scaffolds, block themes with theme.json, Gutenberg blocks, Block Bindings, patterns, abilities for AI assistants, REST routes, custom post types, settings pages, database queries, and much more. Instead of rebuilding the same header, the same register_post_type() signature, or the same Settings API cascade from memory every time, you fill in a few fields and get clean code back — with declare(strict_types=1), a defined( 'ABSPATH' ) || exit guard, and typed signatures.

You pick a generator in the sidebar on the left, enter your values on the right, and the code updates live in the output editor. Larger generators produce several files in tabs, and four of them can pack everything into a ZIP archive with a ready-made folder — a plugin or a block theme is then one click away from being installable. No account, no installation, everything runs in the browser.

The tool is aimed at WordPress developers of every experience level: for beginners it's a learning aid and cheat sheet that shows what a correct API call looks like; for professionals it's an accelerator that handles the same boilerplate in seconds and also covers the new APIs from WordPress 6.9, 7.0, and 7.1, whose details nobody knows by heart yet.

The generators — grouped by topic

The left sidebar bundles 33 code generators in seven groups, plus a library of 40 code snippets and a Dashicons browser. The tool's interface is in English, so the generator names appear in their original spelling.

  • Plugin & Theme — Plugin (main file with header and class, readme.txt, uninstall.php), Theme (block theme with theme.json, templates, parts, style variations, and a pattern — or classic), Nav Menus, wp_nav_menu(), and Sidebar / Widget Area.
  • Blocks & Editor — Gutenberg Block (block.json with apiVersion 3, without a build step, with @wordpress/scripts, or PHP only), SVG Icons (the Icons API from WordPress 7.1), Block Bindings (your own bindings source including Pattern Overrides), Block Patterns, Block Styles, and Block Variations.
  • Hooks & Assets — Hook (Action / Filter) with real parameter types for known hooks, Cron Event, Asset Enqueue (including script modules and build/*.asset.php), Shortcode, oEmbed Provider, and WP-CLI Command.
  • Data Types — Custom Post Type, Taxonomy, Post Status, Post Meta Field, and Term Meta Field — post types, taxonomies, and meta fields each with REST support.
  • APIs — Abilities API (capabilities that AI assistants, MCP clients, and automations can call), REST Route (optionally with real create, update, and delete), and AI Prompt (a function around wp_ai_client_prompt()).
  • Admin UI — Meta Box, Dashboard Widget, Settings Page (Settings API with safe password fields), Admin Bar Nodes, Contact Methods, and Admin Notice.
  • Config & Queries — WP-Config (constants for wp-config.php, up to the new 7.x switches) and Query Builder (nine query types from WP_Query to WP_Date_Query).

On top of that come Code Snippets — 40 ready-made snippets in six groups, from Security & Cleanup to WordPress 7.x & Editor, either as a must-use plugin or for pasting into functions.php — and, under Reference, a Dashicons browser with 349 icons, from which one click copies the CSS class, the block.json name, or ready-made HTML.

How generation works

Every generator is a form. You type, and the tool rebuilds the code after a short delay; the Generate button does the same instantly and jumps to the output. Many fields are linked: the plugin name drives the slug and text domain, the version drives the stable tag — until you change a field yourself; the namespace is reset on every change to the name. Where the tool checks an input, it marks invalid values in red; ten generators that would otherwise produce broken code then show a file that registers nothing, just comments and the list of errors, instead of code. Others substitute a default for empty or unusable fields, some with a warning, some quietly — so it always pays to look at the output. Domain-specific pitfalls — a tag that wordpress.org ignores, or a REST create endpoint with no title, content, or excerpt argument — appear as yellow warnings above the output.

Every output has Copy and Download; with several files, both apply to the active tab. Plugin, Theme, Gutenberg Block, and Block Bindings also offer ZIP: the archive contains all files in a folder named after the slug and — for plugins with a header and for themes — can be uploaded straight to WordPress.

Shared fields save typing: author, author URI, text domains, and function prefixes that you enter in one generator land immediately in the matching, still untouched fields of the other generators — and your browser remembers them for your next visit. The Forget saved defaults button at the bottom of the sidebar clears them again.

A browser app

Architecturally the tool is client-side: all code templates and the generation logic live in the tool's JavaScript and run in your browser. Your input is not transmitted. The only thing stored is what the shared fields need, in your browser's localStorage — not on a server. Apart from loading the editor's own files, only the WP-Config generator sends a request to a server, when you click Generate Salt Keys: it then fetches eight fresh security keys from the JPKCom tools' generator, without sending any form data along.

The generated code is a starting point, not a finished product. It follows WordPress conventions and comes with sensible defaults, but you write the actual functionality yourself — and test it on a staging install before it goes live.

Try it now

→ Open the WP Code Generator — pick a generator, fill in the fields, copy the code or download the ZIP. No account, free, right in the browser.

The generator gives you the scaffold — these tools round out the workflow:

  • Beautify — formats and deobfuscates JavaScript, CSS, and HTML; handy for re-indenting a generated block's JS or a theme's CSS after your own edits.
  • Source Viewer — view source code in 100+ languages with syntax highlighting; useful for reading or sharing a generated snippet.
  • SEO & GEO Analyzer — audit the finished WordPress site for SEO, AI readiness, and technical health.

There's more on the subpages: the manual with every generator and its fields in detail, hands-on examples, and a collection of tips & tricks.