WP Code Generator by

Plugin Settings

Lowercase letters and digits, words separated by single hyphens (my-plugin).
Use a valid PHP namespace such as Acme\Tools.
Use a valid PHP class name such as Plugin.
WordPress blocks the activation while a required plugin is missing or inactive.
readme.txt — not part of the plugin header
The short description of readme.txt is the Description above without markup (wordpress.org keeps 150 characters). The Stable tag follows the version until you edit it and is never trunk. wordpress.org ignores the tags plugin and wordpress and every tag after the fifth, and drops contributors that are not wordpress.org usernames.

Generated files

Theme Settings

Lowercase letters and digits, words separated by single hyphens (my-theme).
Empty = standalone theme. For a child theme: the parent's directory name (the child's own slug must differ from it). A child theme gets no templates and enqueues its own style.css (a classic child optionally the parent's, too). A child of a block theme (e.g. twentytwentyfive) is a block theme itself: check Block Theme.
Suggested from the options until you edit it. Empty = no Tags header.
Standalone classic themes always get index.php, header.php (wp_head()) and footer.php (wp_footer()); child themes use the parent's templates.
In a child theme get_stylesheet_uri() points to the child's style.css, so such a parent loses its own stylesheet. On: the child registers the parent's style.css (get_parent_theme_file_uri()) under the parent's handle <parent>-style and loads it before its own. Off: the child enqueues only its own style.css, at priority 20 so it loads after the parent's stylesheet — right for parents that load theirs with get_template_directory_uri() or get_parent_theme_file_uri().
Only for editor validation and autocomplete (version stays 3). Older WordPress versions silently ignore newer keys; the version next to an option says since when WordPress applies it.
Child theme: theme.json gets only $schema, version and empty settings/styles for your own overrides. WordPress merges it onto the parent's theme.json, and presets in the child (palette, gradients, font sizes, font families) replace the parent's whole lists instead of adding to them — the parent's own styles and patterns would lose the colors and fonts they reference. So the parent's palette, fonts and styles stay in effect; the colors, fonts and other theme.json options here, the style variations and the section style (both use this generator's palette) do not apply. Templates and template parts come from the parent theme, too.

Always written: the palette slugs base/contrast/primary/secondary, a primary-to-secondary gradient and defaultPalette/defaultGradients: false. With the duotone filter defaultDuotone: false shows only this filter in the duotone picker; without it the key is left out and the core duotone presets stay available. Hidden core presets remain defined as CSS variables, only the pickers leave them out.

Used until the font file has loaded, or when it is missing.
Sets typography.textIndent and a 1.5em indent for core/paragraph.

Breakpoints: px, em or rem (em/rem count as 16px), tablet larger than mobile. Without them WordPress uses 480px/782px. @mobile = up to mobile, @tablet = above mobile up to tablet; there is no @desktop.
Templates & Template Parts
The area groups a part in the Site Editor, and the navigation block offers only navigation-overlay parts as its overlay; WordPress has no sidebar area. Without template parts the header (site title + navigation) and the footer are written into every template. blank.html holds only the post content; theme.json declares it as “Blank” for pages and posts (customTemplates is written only together with the file). Child themes get no templates or parts: the parent theme provides them.
Style Variations, Pattern & Editor Style
Style variations
Title File styles/….json Base Contrast Primary Secondary Remove
The first row inverts the palette (Base and Contrast swapped, Primary and Secondary kept; Add Variation brings it back after removing it): “Dark” for a light theme, “Light” for a dark one. Its title and colors follow the palette until you edit them; the file name follows the title. File names: lowercase letters, digits and hyphens, each only once. WordPress lists the variations under Styles in the Site Editor, sorted by file name.
WordPress registers the section style as a block style by itself (no PHP needed). Theme patterns register themselves from their file headers; outside WP_DEVELOPMENT_MODE ‘theme’ WordPress caches the pattern list, so bump the theme version after adding patterns.

Generated files

Block Settings

Lowercase letters, digits and hyphens, starting with a letter.
Lowercase letters, digits and hyphens, starting with a letter.
Lowercase letters, digits and hyphens, starting with a letter.
Adds a block_categories_all filter to the PHP file.
PHP only (WordPress 7.0): one PHP file, no JavaScript. supports.autoRegister generates the inspector controls for string, number, integer and boolean attributes (enums become a select). No media, InnerBlocks, RichText or HTML sources; the editor preview is ServerSideRender.
Build step: run npm install --save-dev @wordpress/scripts, then npm run build. The sources live in src/<block>/; wp-scripts writes build/<block>/ and build/blocks-manifest.php, which the PHP file registers.
Name Type Default Enum Source Selector Attribute Role Label Remove
Give text and URL attributes the role content: in WordPress 7.0 patterns only show content-role attributes of blocks for editing (fallback for a whole block: supports.contentRole, for containers: supports.listView). local attributes are never serialized. Enum = comma-separated values.
Adds a block_bindings_supported_attributes_<namespace/name> filter (WordPress 6.9) to the PHP file: these attributes can then be bound to a source (core/post-meta, your own) and overridden in synced patterns (Pattern Overrides, WordPress 7.0).
Static block: a bound value only replaces saved markup for attributes with the source html, rich-text or attribute and a plain tag selector (h2, p, a) — WordPress matches tag names only, a class selector such as .title is ignored. Dynamic block: bound values arrive in $attributes of the render code — escape them yourself (esc_html(), esc_url()); the generated render code escapes string attributes. Pattern Overrides: the block needs a name (metadata.name) and the binding __default → core/pattern-overrides inside the synced pattern (“Enable overrides” in the editor). The editor's field picker skips attributes with an enum and only offers fields of the same type.
Many style controls only appear when the theme enables them (settings.* or appearanceTools in theme.json).
Positions: before, after, firstChild, lastChild. Hooked blocks should be dynamic.

Generated files

Hook Settings

hooks.php

Cron Event Settings

cron.php

Asset Settings

Relative path (default per type), https://… URL, or a raw PHP expression (contains (, $ or ').

enqueue.php

Shortcode Settings

No spaces or & / < > [ ] = — WordPress rejects such tags.
Attribute Name Default Value

shortcode.php

Custom Post Type Settings

Not a valid JSON array of [ "block/name", { attributes }, [ inner blocks ] ].
Block Bindings (post meta in blocks, core/post-meta). Without show_in_rest this post type has no block editor, so its meta cannot be bound or edited there. Without custom-fields support the REST API leaves out the meta, so the editor neither lists nor shows the fields (enable “custom-fields” under Supports). Bound blocks in templates still render the values on the front end.

cpt.php

Taxonomy Settings

taxonomy.php

Post Status Settings

post-status.php

Meta Box Settings

Type Meta Key Label

meta-box.php

Dashboard Widget Settings

dashboard-widget.php

Settings Page Settings

Every field is a password, and passwords never enter the REST API: the setting is not exposed in /wp/v2/settings. Add a field of another type to expose it.
Section ID Section Title Description
Field ID Label Type Section ID Help text

settings-page.php

Admin Bar Settings

Node ID Title Parent ID href Meta (optional) _blank

admin-bar.php

Contact Methods Settings

Field Key (becomes user meta key) Label
Field Key to Remove

contact-methods.php

wp-config.php Settings

Only letters, numbers and underscores.
true, false, -1 or a number.

Connector API keys (7.0) are better kept in environment variables of the same name than in wp-config.php.


Fetches 8 unique 64-char keys from the local generator API and inserts them into the output.

wp-config.php

Query Builder

KeyValueCompareType
TaxonomyFieldTermsOperator
TaxonomyFieldTermsOperatorChildren
KeyValueCompareType
After (YYYY-MM-DD)Before (YYYY-MM-DD)Inclusive

query.php

Post Meta Field Settings

Leave empty to register for all post types.

post-meta.php

Term Meta Field Settings

term-meta.php

wp_nav_menu() Settings

0 = all levels

nav-menu.php

Nav Menus Settings

nav-menus.php

Sidebar Settings

sidebars.php

Command Settings

Subcommands

No subcommands yet — click "Add Subcommand" above.

wpcli-commands.php

oEmbed Provider Settings

URL Pattern oEmbed Endpoint Regex

oembed-providers.php

Dashicons Browser 349 icons — click to copy

Code Snippet

Generated Snippet

Ability Settings

Lowercase letters, digits and hyphens only (a-z 0-9 -).
Lowercase letters and digits, single hyphens between them (my-category).
Lowercase letters, digits and hyphens only — no slash, the namespace adds it.
Name: my-plugin/get-recent-posts
Written for agents: say what the ability does and when to use it — AI clients pick abilities by this text.
Key Type Description Required Default Enum Minimum Maximum minLength maxLength Pattern Items type Format Remove
Keys are PHP identifiers (letters, digits, underscores). Enum = comma-separated values; array/object defaults as JSON. required becomes one object-level list; without required properties the schema gets 'default' => array(), so the ability also runs without input. WordPress does not inject property defaults — the generated callback applies them with ??; the JavaScript client does insert them and validates them, so a default that breaks its own constraints is skipped. Patterns are checked by PHP (PCRE) on the server and by JavaScript in the client: type characters instead of \u escapes and use short Unicode classes such as \p{L}. Formats: email, date-time and uuid are checked by WordPress and by the JavaScript client, uri only by the JavaScript client.
Key Type Items type Format Description required Remove
WordPress validates the result against this schema after the execute callback — a mismatch returns ability_invalid_output instead of the result.
Enter a capability name (letters, digits, underscores, hyphens).
REST method: GET
Extras

Generated files

Icon Settings

Lowercase letters, digits, hyphens and underscores; start and end with a letter or digit.
Icons
Name Label Source SVG markup Remove
Enter the name without the collection: star registers my-plugin/star. Source inline passes the markup as content; file adds icons/<name>.svg to the output and registers its file_path (read on first use).
Runs on init with priority 20, after core registered its icons (priority 10). plus means core/plus.

Generated files

Block Bindings Settings

Lowercase letters and digits, words joined by single hyphens (my-bindings).
A PHP namespace such as Acme\Bindings: letters, digits and underscores, segments joined by \, no leading digit.
Lowercase namespace/name: letters, digits and hyphens with exactly one slash.
Blocks refer to it in metadata.bindings.<attribute>.source.
Context (uses_context)
postId and postType are always included: the values are post meta. termId/taxonomy come from a Terms Query (core/term-template).
Context keys that a parent block provides (providesContext); the value callback reads them from $block_instance->context.
The meta is registered for these post types. Custom post types need 'supports' => array( 'custom-fields' ) and show_in_rest, otherwise the editor cannot read or save the values.
Fields
Field (args.field) Label Type Meta key Sanitize Remove
Block markup selects a field with "args":{"field":"isbn"}. An empty meta key becomes slug + field in snake case (my_bindings_isbn). The type decides which attributes a field can bind to in the editor: string fields bind to text and URL attributes (paragraph, heading, button, image …), integer/number/boolean fields to attributes of that type (e.g. of your own block); integer fields are offered for number attributes too, such as the image ID (core/image id). An integer, number or boolean field without a stored value returns null, so the block keeps its own attribute value (its default) — on the site and in the editor.
A block name: lowercase namespace/name with letters, digits and hyphens.
Opts the block into Block Bindings and — since WordPress 7.0 — Pattern Overrides via block_bindings_supported_attributes_{block-name}. Static blocks: each attribute needs source html, rich-text or attribute with a plain tag selector (h2, not .title). Dynamic blocks receive the bound values in $attributes and must escape them.

Generated files

Block Pattern Settings

Themes: WordPress reads the headers of every patterns/*.php file. Plugins register each pattern in PHP.
Lowercase letters and digits, words joined by single hyphens or underscores (my-theme).
Lowercase letters and digits, words joined by single hyphens or underscores (hero).
Preset Texts empty = default text
Written as translatable strings with esc_html_e() and the text domain above: WordPress escapes them when the pattern is loaded, so HTML in a text shows as text.
Paste the block markup of the pattern.
Written into the pattern file as it is. <?php … ?> and <?= … ?> run as PHP each time WordPress loads the pattern, e.g. <?php esc_html_e( 'Hello', 'my-theme' ); ?> for translatable text — you are responsible for valid PHP (an error breaks the pattern, and a fatal one the page; the file declares strict_types=1). Any other <? (such as <?xml) stays plain text.
Core Categories
Registered by WordPress on init. A pattern without any category is listed under Uncategorized.
Lowercase letters and digits, words joined by single hyphens or underscores.
Offers the pattern for these blocks (placeholders, transforms); core/post-content + post type page makes it a starter pattern for new pages, core/template-part/header one for header parts.
Empty = everywhere. Otherwise the pattern is only available while editing these post types.
Templates the pattern fits (offered when a template is created in the Site Editor).
A whole number of pixels, e.g. 1200.

Generated files

Block Style Settings

One block or several (6.6): the same style is offered in the Styles panel of each.
Lowercase letters, digits, hyphens and underscores, starting with a letter or digit (card).
A theme color (var:preset|color|base) or a CSS color (#f5f5f5).
A theme color (var:preset|color|contrast) or a CSS color (#111111).
One to four lengths like CSS padding (1.5rem, 1rem 2rem) or spacing presets (var:preset|spacing|40).
A CSS radius (8px, 0.5rem) or a radius preset (var:preset|border-radius|md).
A CSS width (1px, thin).
A theme color (var:preset|color|contrast) or a CSS color.
Empty fields are left out. var:preset|color|<slug> refers to a color of the active theme's palette and follows it when the palette changes.
Letters, digits, hyphens, underscores and dots (my-plugin-block-styles).
Decides how the URL and the path for the filemtime() version are built.
A relative path to a .css file inside the plugin or theme, without .. or . path segments (assets/block-styles.css).
Enter the CSS of the style.
Added with wp_add_inline_style() to the block's stylesheet (or wp-block-library). Target the class .is-style-<name>.
Content of the stylesheet file (an extra file tab below). Target the class .is-style-<name>.
Removes styles other code offers, e.g. core/quote:plain or core/button:outline. Styles registered in PHP (register_block_style()) are removed with unregister_block_style() in the editor and on the site, including their CSS. Styles from a block.json (all core styles) are only hidden in the editor; their CSS stays. theme.json section styles (e.g. Twenty Twenty-Five core/group:section-1) are hidden in the editor too, but blocks that already use them also lose their look in the editor while the site keeps it — remove those only when no content uses them.

Generated files

Block Variation Settings

Filter: adds the variations to any block registered in PHP (all core blocks, block.json blocks); a block registered only in JavaScript needs wp.blocks.registerBlockVariation(). File: the variations of your own block, referenced from its block.json.
A block name such as core/group (lowercase, namespace/name).
Variations one registration per row
Name / Title Description / Icon (Dashicon) Attributes JSON object Inner blocks JSON array isActive / Keywords Scope / Default Remove
name: lowercase letters, digits, hyphens and underscores, optionally with one namespace (my-plugin/books-list); each name only once. The title follows the name until you edit it. icon: a Dashicon name such as id-alt (see the Dashicons browser). attributes: initial attribute values of the inserted block. inner blocks: template form [name, attributes, innerBlocks] or objects {"name":…,"attributes":…,"innerBlocks":…}. isActive: comma-separated attribute names — the block shows as this variation while they equal the values in attributes (dot paths like style.color.text work). keywords: comma-separated. scope: none checked = WordPress default: block + inserter. default: isDefault.

block-variations.php

REST Route Settings

Segments of letters, digits, dots, hyphens and underscores separated by single slashes, no slash at the start or end (my-plugin/v1).
Path segments of letters, digits, hyphens and underscores (/books or /shelves/books).
Endpoint: /wp-json/my-plugin/v1/books/{id}
Methods one handler each
Select at least one method.
Per-object checks need the ID segment: switch it on or pick a capability.
Per object checks read_post (GET), edit_post (POST, PUT, PATCH) or delete_post (DELETE) against the route's id.
Letters, digits, underscores and hyphens (edit_posts).
Arguments tick the methods each argument applies to
Name Type Methods Required Default Enum Minimum Maximum Format Description Remove
No extra arguments yet — the ID segment adds the argument id itself (integer, minimum 1, required).
WordPress validates and sanitizes every argument with a type itself (rest_parse_request_arg()) before the permission check and the handler run; an invalid value answers 400 rest_invalid_param, a missing required one 400 rest_missing_callback_param. Each argument is registered only for the handlers of the ticked methods (EDIT = POST, PUT, PATCH); GET handlers also get context (view or edit). array arguments get an items schema, object arguments a properties schema from the key:type list (other keys are then rejected); their defaults are JSON. Enum = comma-separated values. minimum/maximum apply to integer and number, format to strings: date-time, email, hex-color, ip and uuid are validated, uri is only cleaned with sanitize_url(). Defaults go through the same checks on every request that leaves the argument out, so a default that breaks its own constraints is left out.
Lowercase letters, digits, hyphens and underscores, at most 20 characters (post, book).
POST creates a draft of this type (or the status from a status argument), EDIT updates, DELETE moves it to the trash. The arguments title, content, excerpt and status (strings) fill the post, every other argument is saved as post meta. With the ID segment, POST moves to the collection route.
Start with a letter; letters, digits and spaces or underscores (book, book review).
Singular, for names and messages; empty = from the route.
Empty = from the namespace.
Empty = from the namespace.

rest-route.php

AI Prompt Settings

PHP does not accept this word as a function name.
Called as my_plugin_ai_generate( $prompt ); it returns the answer or a WP_Error.
A number from 0 to 2.
A whole number of at least 1.
Enter a JSON object.
Emitted as a PHP array and passed to as_json_response(). The function decodes the answer with json_decode() and returns an array; the provider decides how strictly it follows the schema.
Segments of letters, digits, dots, hyphens and underscores separated by single slashes, no slash at the start or end (my-plugin/v1).
Path segments of letters, digits, hyphens and underscores (/generate).
Letters, digits, underscores and hyphens (edit_posts).
A whole number of at least 1.
maxLength of the prompt argument; empty = no limit.
Endpoint: POST /wp-json/my-plugin/v1/generate

ai-prompt.php

Admin Notice Settings

Enter the text of the notice.
Plain text is escaped with esc_html__(). With markup the message goes through __() and wp_kses() with exactly these four tags (only href on links); every link target becomes a sprintf() placeholder, so translators never edit URLs. Admin pages such as options-general.php?page=my-plugin are linked with self_admin_url().
Site admin, network admin, user admin, or every admin (all_).
PHP does not accept this word as a function name.
Hooked by name, so other code can remove_action() it.
Screen IDs are lowercase letters, digits, hyphens and underscores (settings_page_my-plugin, edit-post, dashboard).
Compared with get_current_screen()?->id; separate several IDs with commas.
Letters, digits, underscores and hyphens (manage_options).
Users without it see nothing (current_user_can()).
Letters, digits, hyphens and underscores, without spaces or quotes.
CSS class names of letters, digits, hyphens and underscores, separated by spaces.
Only what wp_kses_post() keeps on a <div>: data-*, nine aria-* attributes (aria-label, aria-live, aria-describedby, aria-labelledby, aria-hidden, aria-expanded, aria-controls, aria-current, aria-details — not every aria-*), role, title, lang, dir, style, tabindex, hidden, popover, align, xml:lang. A name without a value becomes a boolean attribute.

admin-notice.php