What it does: Generates production-ready PHP code for WordPress custom meta boxes—complete with fields, validation, and sanitization—so you can skip the boilerplate and get straight to building.
Best for: WordPress developers who want clean, dependency-free meta box code they fully control.
Cost: Free. No account required.

Creating a Meta Box in Under a Minute
I opened the Meta Box Generator and typed “Book Details” as my meta box title. The tool immediately auto-populated the key prefix (book_details_), text domain (book-details), and class name (Book_Details_Meta_Box). No signup wall, no email capture—it just works.
I unchecked “Posts” and entered book in the Custom Post Types field to target my custom post type. Then I added three fields: a text field for Author, a date field for Publication Date, and a number field for Page Count. Each field appeared with expandable options for default values and constraints like min/max.

As I configured each field, the Generated Code panel updated in real-time. The output showed a complete PHP class with:
- WordPress hooks for
add_meta_boxes,save_post, andadmin_head - Nonce verification for security
- Proper sanitization per field type
- A helpful comment block showing how to retrieve each value with
get_post_meta()

I clicked “Download PHP” and got a file named class-book-details-meta-box.php—ready to drop into my theme’s inc/ folder and require in functions.php.
16 Field Types That Cover the Essentials
The generator includes the field types you’ll reach for most often, organized into four categories:
Basic: Text, Textarea, Email, URL, Phone, Password
Numeric: Number, Range, Date, Time, Month, Week
Choice: Checkbox, Radio, Select
Rich: Color (with WordPress color picker), Editor (TinyMCE), Media (with WordPress media uploader)
For Radio and Select fields, you enter options in a value|Label format, one per line. The generated code handles option rendering automatically.
Why Generate Code Instead of Using a Plugin?
Plugins like ACF and Meta Box (the plugin) are powerful, but they come with trade-offs: another dependency to maintain, field configurations stored in the database, and potential compatibility concerns during updates.
The Meta Box Generator takes a different approach. You get standalone PHP that:
- Has zero runtime dependencies—the generated code runs on its own
- Lives in version control—your field definitions are in code, not the database
- Won’t break during plugin updates—because there’s no plugin to update
- Follows WordPress coding standards—including proper escaping, nonces, and sanitization
For developers who prefer code they can read, modify, and own outright, this is the appeal.
Save and Reuse Configurations
The export/import feature lets you save your field setup as JSON. This is useful for:
- Reusing a configuration across multiple projects
- Sharing setups with team members
- Backing up before making changes
Registered users can also save configurations to the cloud for easy access across devices.
When You Might Need More
The Meta Box Generator is built for straightforward use cases: a handful of custom fields for a CPT, extra options on posts or pages, simple data entry forms in the admin.
If your project requires repeater fields (multiple instances of a field group), conditional logic (show/hide fields based on values), or relationship fields (linking to other posts or users), you’ll want a full-featured solution like ACF Pro or the Meta Box plugin.
But for the 80% of cases where you just need a clean set of fields without plugin overhead, the Meta Box Generator gets you there fast.