WordPress Meta Fields Generator

Create custom meta fields for a Custom Post Type or Custom Taxonomy (term meta). Add unlimited fields, pick types, and generate secure PHP code with proper sanitization.
All Tools
Choose whether to attach meta fields to CPT items (post meta) or taxonomy terms (term meta).
Comma-separated CPT keys. Meta box will appear on these edit screens.
Shown as meta box title (CPT) or section title (taxonomy).
Prefix to avoid conflicts. Example: gg_isbn, gg_author.
Useful for Gutenberg and headless WordPress.
Most meta fields are single. Use multiple only if you need repeated values.

Meta fields
Add as many fields as you want. Each field generates admin inputs + saving logic.

Paste into functions.php (child theme recommended) or a small plugin. For term meta, it will hook into taxonomy add/edit screens.

WordPress custom fields generator for CPT and taxonomy meta

Need a fast way to create WordPress custom fields (post meta) for a Custom Post Type or add taxonomy term meta fields to categories, tags, or custom taxonomies? This tool generates clean PHP code that creates admin forms (meta boxes or term screens), saves values securely with nonces, and sanitizes data correctly for each field type.

Use it for real-world content models like Books (ISBN, Author), Products (SKU, Warranty), Events (Date, Venue), or Locations (Map URL, Address).

Frequently Asked Questions (FAQ)

1. What are WordPress meta fields?

Meta fields (custom fields) are extra data saved with a post, page, CPT item, or taxonomy term.

2. What’s the difference between post meta and term meta?

Post meta is saved per post/CPT item. Term meta is saved per taxonomy term (like a category or a custom taxonomy term).

3. Do I need ACF for custom fields?

No. ACF is helpful, but WordPress supports meta fields natively. This tool generates the PHP code for you.

4. Is the generated code secure?

Yes. It includes nonces, capability checks, and sanitization tailored to each field type.

5. Can I add fields to multiple CPTs?

Yes. Enter multiple CPT keys separated by commas. One meta box can appear on multiple edit screens.

6. What does “register meta in REST” mean?

It enables WordPress REST API exposure for the meta field (useful for Gutenberg and headless setups).

7. How do I display meta values on the front-end?

Use get_post_meta($post_id, 'meta_key', true) or get_term_meta($term_id, 'meta_key', true).

8. Can I create select/radio options?

Yes. Use Select or Radio type and provide comma-separated options in the field settings.

9. Can I store images and files?

Yes. This tool can generate fields that store attachment IDs and includes a media uploader button.

10. Will this slow down my site?

No. Meta field registration and saving hooks are lightweight. Performance depends on queries and how much meta you load.

Tips
  • Use a prefix like gg_ to avoid meta key collisions.
  • Keep keys stable after saving content to prevent missing data.
  • Use REST support if you plan to use Gutenberg or headless WordPress.
Popular field types
Text Number Date Select Image WYSIWYG
Note
This generator creates standard WordPress admin UI. If you prefer a UI framework (like ACF), this code still helps you understand the correct hooks and sanitization.