WP Code Generator — Manual
Full feature reference for the WP Code Generator: every generator, the snippet library, configurable fields, the output mechanics, and the limits.
Back to the overview: WP Code Generator · Open the tool live: www.jpkc.com/tools/wp/
This manual describes the WP Code Generator in full: how the interface is laid out, how generation works, what each generator does and which fields it offers, what the snippet library contains, and where the limits are. The tool's interface is in English, so the generator and field names appear in their original spelling throughout.
Layout and operation
The tool is split in two: a sidebar on the left listing all generators (organized into groups), and the work area on the right for the selected generator — a form on top, the output editor below. You pick a generator, fill in the fields, and read the code straight from the editor.
Live generation
As soon as you change a field, the tool rebuilds the code automatically (debounced with a short delay so it doesn't stutter as you type). Each generator also has a Generate button that triggers the same thing manually. There's no server round-trip — the rebuild happens instantly in the browser.
Multi-file outputs
Some generators produce more than one file. They show the outputs in file tabs above the editor:
- Theme →
style.css,functions.php, and (for block themes)theme.json. - Gutenberg Block →
block.jsonandregister.php.
Copy and Download
Each output area has two buttons: Copy puts the current editor content on the clipboard, Download saves it as a file with a sensible name (plugin.php, theme.json, cpt.php, query.php, …). For multi-file generators, Copy/Download always refer to the active file tab. If you haven't generated the code yet, you get a prompt ("Generate code first by switching to this tab").
Code style and target version
The generated code targets WordPress 6.8+ and modern PHP (the "Requires PHP" default is 8.3). It consistently uses declare(strict_types=1), a defined('ABSPATH') || exit guard in standalone files, typed function signatures, arrow-function callbacks, and WordPress-conformant hook registration. The code follows the WordPress coding standards but is deliberately a scaffold — you add the business logic yourself.
Group "Plugin & Theme"
Plugin
Generates the full plugin header plus a main class. Fields: Plugin Name, Namespace / Main Class, Text Domain, Version, Author, Author URI, Plugin URI, License (GPL-2.0-or-later, GPL-3.0-or-later, MIT, Proprietary), Requires WP (default 6.8), Requires PHP (default 8.3), Requires Plugins (optional, WP 6.5+), Tested up to, Stable tag, Network (multisite only), and Description.
Convenience: the text domain and namespace are derived automatically from the plugin name as you type (text domain as a slug, namespace in PascalCase) — you can override both afterwards. The text domain must match the plugin directory name.
Theme
Generates style.css (with the theme header) and functions.php. Fields: Theme Name, Text Domain, Version, Author, Author URI, Theme URI, Requires WP, Parent Theme (for child themes only — enter the parent theme's directory name, otherwise leave it empty), and Description.
The Block Theme (Full Site Editing) checkbox unlocks an extra theme.json tab and reveals options: a color palette (Primary, Secondary, Background, Foreground as color pickers), layout sizes (Content Width, Wide Width), and the option to include templateParts (header & footer) plus a blank custom template. For block themes, functions.php only handles feature registration.
Gutenberg Block
Generates a block.json and the PHP registration via register_block_type(). Fields: Namespace (plugin/theme slug), Block Name (slug), Title, Category (text, media, design, widgets, theme, embed), Icon (Dashicon slug), Keywords, Description, and the Supports (align, color.text, color.background, typography.fontSize). The Dynamic Block (server-side render) checkbox reveals a field for the render callback; for dynamic blocks the JS save() function returns null and PHP renders. The block name uses the format namespace/block-name, both parts lowercase.
Nav Menus
Registers menu locations (register_nav_menus()) so a theme can offer several menu spots (e.g. "Primary", "Footer").
wp_nav_menu()
Generates the call to output a menu. Configurable options include the container (and thus container class/ID and ARIA label), an optional fallback (a custom function), and an optional walker.
Sidebar / Widget Area
Registers one or more widget areas (register_sidebar()) with selectable wrapper markup (standard or a custom HTML wrapper).
Group "Hooks & Assets"
Hook (Action / Filter)
Generates a hook registration. Fields: Type (Action via add_action or Filter via add_filter), Hook Name (with autocomplete from a list of common core and WooCommerce hooks), Priority (default 10, lower number = earlier execution), Accepted Args (1–10), and Callback Function Name. Important: Action callbacks return void, Filter callbacks must return the (modified) value, and Accepted Args must match the number of parameters the hook actually passes.
Cron Event
Generates a scheduled event via the WP-Cron API. Schedule picks the interval (Hourly, Twice Daily, Daily, Weekly, or Custom); with Custom Interval you set the value and unit (Minutes/Hours) yourself.
Asset Enqueue
Generates a clean enqueue for CSS or JavaScript. Type (CSS Stylesheet / JavaScript), Hook (wp_enqueue_scripts, admin_enqueue_scripts, login_enqueue_scripts), and Version Strategy (a fixed version string, filemtime() for automatic cache busting, or false). JS offers the footer option, CSS the media attribute.
Shortcode
Generates a shortcode registration (add_shortcode()) along with a callback scaffold that handles attributes.
oEmbed Provider
Generates the registration of custom oEmbed providers (wp_oembed_add_provider()).
WP-CLI Command
Generates a WP-CLI command with subcommands. You define the command name and subcommands; the output's file name follows the command name.
Group "Data Types"
Custom Post Type
Generates register_post_type() with a full labels array, supports, REST integration, archive and rewrite options, and an icon.
Taxonomy
Generates register_taxonomy() — the associated post type(s), hierarchy (category- or tag-like), labels, and REST integration.
Post Status
Registers a custom post status (register_post_status()).
Post Meta Field
Registers a post meta field (register_post_meta()) with type, single/multiple, REST visibility, and auth and sanitize callbacks. The sanitize callback is suggested automatically by type (string → sanitize_text_field, integer → absint, number → floatval …); both callbacks can be set to "custom".
Term Meta Field
Like Post Meta Field, but for taxonomy terms (register_term_meta()) — with the same type-dependent callback logic.
Group "Admin UI"
Meta Box
Generates a meta box (add_meta_box()) including a render callback, nonce check, and save logic. The screen is selectable, including "custom" for your own post types.
Dashboard Widget
Generates a dashboard widget (wp_add_dashboard_widget()) with a render callback.
Settings Page
Generates a settings page via the Settings API — as a top-level menu item or a submenu (with a selectable parent slug), including registration of sections and fields.
Admin Bar Nodes
Generates adding or removing nodes in the admin bar (admin_bar_menu).
Contact Methods
Generates customizing the user profile contact fields (user_contactmethods) — adding fields and removing default ones.
Group "Config & Queries"
WP-Config
Generates constant blocks for wp-config.php (e.g. debug, security, performance, and memory constants) to paste in.
Query Builder
Generates a WordPress database query. Query Type lets you choose one of nine query kinds, and the form adapts: WP_Query (posts), get_users(), get_terms(), get_comments(), WP_Network_Query and WP_Site_Query (both multisite), and the standalone WP_Tax_Query, WP_Meta_Query, and WP_Date_Query. Each type exposes matching fields (e.g. WP_Query offers post type, status, posts per page, and ordering); an info box explains the selected type.
Group "Snippets": the theme snippet library
The Theme Snippets tab isn't a form-based generator but a library of 30 ready-made functions.php snippets. You pick an entry from the Snippet dropdown; below it appears a short description, optionally a small options panel (some snippets have toggles), and a Text Domain / Prefix field that gives the generated function names a custom prefix. The code updates live; Copy/Download save it as <snippet-id>.php.
The 30 snippets are organized into five categories (the original optgroup labels):
- Security & Cleanup (14) — among others: remove the generator meta tag, remove emoji support, remove Dashicons from the frontend, disable XML-RPC, remove version query strings, enable Argon2ID passwords, globally disable comments, hide login error messages, prevent user enumeration, hide the REST
usersendpoint, disable the file editor, add security headers, restrict the public REST API. - Content & Output (5) — set excerpt length and "read more" text, remove block editor CSS from the frontend, register a custom image size, derive missing alt text for Gutenberg images.
- Admin & Customisation (3) — defer/async scripts, custom login logo, custom admin footer text.
- Branding (5) — custom email sender, remove the WP logo from the admin bar, white-label admin, remove dashboard widgets, add a custom dashboard widget.
- Misc & SEO (3) — redirect attachment pages, limit post revisions, disable RSS feeds.
A note on counting: the marketing line says "31 snippets" — the tool offers exactly 30 selectable snippets. If you count a different number, that may be down to later additions to the library.
Group "Reference": Dashicons
The Dashicons browser shows the 349 WordPress admin icons. Click an icon to copy its slug — handy for setting a custom post type's menu_icon or a Gutenberg block's icon, for example. This is a reference, not a code generator.
Architecture and limits
- Entirely client-side. All code templates and the generation logic sit in the tool's JavaScript and run completely in the browser. There's no server round-trip, no data transfer, and no server-side processing of your input.
- Scaffold, not a finished plugin. The code is syntactically correct and conformant but deliberately contains placeholders and empty callback bodies. You write the business logic yourself.
- No validation against WordPress. The tool doesn't know whether a hook name exists or a slug is already taken — it shapes your input into code but doesn't check it against a running installation.
- Editor output. The display uses the ACE editor; you work with Copy/Download, not a packaged file export.
- No AI involved. The generator is purely template-based and deterministic — there's no AI component.
For the introduction and target audiences see the overview. Concrete workflows are in the examples, strategy and gotchas in the tips & tricks. You can try everything directly in the tool.