WordPress CPT + Taxonomy Generator

Generate register_post_type() + register_taxonomy() together — copy/paste or download a ready PHP snippet.
All Tools
One snippet • CPT + Taxonomy • Copy & Download
Basic mode
Create a CPT and attach a taxonomy to it in one go. Ideal for common use cases like Books + Genres, Products + Brands, Events + Locations.
1) Custom Post Type (CPT)
Used in labels like “Add New Book”.
Used in menu labels like “Books”.
Lowercase + underscores. Example: book or portfolio_item.
Public URLs like /books/my-book.
Controls front-end visibility.
Enables /books archive page.
Recommended for Gutenberg and REST.
Choose the editor features enabled for the CPT.

2) Custom Taxonomy
This is the taxonomy key used in code and queries.
Term URLs like /genre/sci-fi.
Parent/child terms for category-style taxonomy.
Adds taxonomy column in CPT list screen.

Paste into functions.php (child theme recommended) or a small plugin. After changes: Settings → Permalinks → Save.

WordPress CPT and Taxonomy generator (combined)

Building structured content in WordPress often needs both a Custom Post Type and a Custom Taxonomy. For example, you might create a Books CPT and a Genres taxonomy, or a Products CPT with a Brands taxonomy. This combined generator produces a clean, copy-paste PHP snippet that registers both together using register_post_type() and register_taxonomy().

Use Basic mode for quick setup. Use Advanced mode for complete control over labels, permalinks, archive pages, REST API support, and admin behavior.

Frequently Asked Questions (FAQ)

1. Why generate CPT and taxonomy together?

Most real-world WordPress sites need both: the CPT stores content items, and the taxonomy organizes them into terms.

2. Will the taxonomy automatically attach to the CPT?

Yes. The generated code registers the taxonomy and attaches it to the selected post type(s).

3. Do I need to flush permalinks?

Yes after adding or changing rewrite slugs. Go to Settings → Permalinks → Save.

4. Should I enable show_in_rest?

Typically yes. It enables Gutenberg support and REST endpoints for headless WordPress setups.

5. Can I attach one taxonomy to multiple post types?

Yes. In Advanced mode, enter multiple post types separated by commas.

6. What’s hierarchical taxonomy?

Hierarchical taxonomies behave like categories (parent/child). Non-hierarchical behave like tags.

7. Where should I paste the generated code?

Paste into functions.php (child theme) or a custom plugin. A plugin is best if your CPT is core site structure.

8. Will this break existing content?

If you change CPT keys or rewrite slugs after content exists, URLs can change. Plan stable keys early.

9. Can I customize labels later?

Yes. Labels only affect admin UI text, not stored data.

10. Is this tool storing my inputs?

No. Everything runs locally in your browser.

Quick sample ideas
Books + Genres Products + Brands Events + Locations Courses + Topics Properties + Areas

Tip: If the CPT is essential to your site, register it via a custom plugin so theme changes don’t remove it.