WordPress Custom Post Type Generator
Generate register_post_type() code for WordPress as you type. Set labels, URL slug, editor features, block editor support, menu icon and an optional custom taxonomy, with instant checks for invalid keys.
Generate register_post_type() code for WordPress as you type. Set labels, URL slug, editor features, block editor support, menu icon and an optional custom taxonomy, with instant checks for invalid keys.
Be the first to share your experience
About this tool
WordPress Custom Post Type Generator writes the PHP to register a new content type, such as Products, Events or Portfolio items, and updates the code live as you change the form. Enter the singular and plural labels, and the post type key and URL slug are filled in for you; you can edit both. Choose which editor features the type supports, including title, editor, featured image, excerpt, custom fields, comments, revisions and page attributes. Decide whether it is public, has an archive page, appears in search, uses the block editor through the REST API, and can have parent items like Pages. Pick the admin menu position and a Dashicon, and optionally add a custom taxonomy such as Product Categories, either hierarchical like categories or flat like tags. The generator checks your settings as you type: it flags keys longer than WordPress allows, reserved names like post or order, and settings that do not fit together. All labels are escaped for PHP, so names with apostrophes are safe. Copy the code or download it as a .php file.

Enter singular and plural labels such as Book and Books. The key and URL slug are filled in automatically.
Select editor features and set public, archive, search, block editor and hierarchy options.
Turn on a custom taxonomy to group items, like Genres for Books.
Copy or download the PHP, add it to a plugin or functions.php, then visit Settings → Permalinks once.
The PHP updates with every change, so you see exactly what each option adds.
Warns about keys over 20 characters, reserved names and options that conflict, before you paste broken code.
Show in REST is on by default, so the post type uses the block editor and appears in the REST API.
Generate a matching category-style or tag-style taxonomy in the same file.
Structured content beyond posts and pages
List products with their own URLs and archive, without a full shop plugin.
ExampleA “Product” type with featured image and excerpt, plus a “Product Category” taxonomy, served at /products/.
Keep projects separate from blog posts with their own templates.
ExampleA “Project” type at /work/ uses single-project.php for a custom case study layout.
Store people or quotes as items editors can manage in wp-admin.
ExampleA private “Testimonial” type without public URLs, shown on the homepage through WP_Query.
Create events, jobs or properties with custom fields for dates and prices.
ExampleAn “Event” type with custom fields support stores the event date as post meta.
Create a hierarchical type so lessons can sit under courses.
ExampleA hierarchical “Course” type with Page attributes lets editors nest lessons under each course.
Organise downloads, guides or FAQs as their own content type with a taxonomy.
ExampleA “Resource” type with a flat “Resource Type” taxonomy groups guides, templates and checklists.
Avoid the common problems
New post type URLs return 404 until rewrite rules are refreshed. Visit Settings → Permalinks and click Save once after adding the code.
If the code lives in a theme, the content disappears from wp-admin when the theme changes. Our plugin generator gives you a place to put it.
Open Plugin Boilerplate GeneratorKeys are limited to 20 characters and should be specific, like shop_product, to avoid clashes with other plugins.
Create single-{key}.php and archive-{key}.php in your theme to control how items and listings look.
Turn Public off for internal content like testimonials; the generated code then keeps it out of search and removes its URLs.
The Usage tab gives a WP_Query loop and template file names for your post type, ready to paste.