Skip to content
Settings → register_post_type() PHPWordPress tools

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.

About this tool

About WordPress Custom Post Type Generator

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.

WordPress Custom Post Type Generator tool

What people build with custom post types

Structured content beyond posts and pages

Product catalogues

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/.

Portfolios and case studies

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.

Team and testimonials

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.

Events and listings

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.

Courses and lessons

Create a hierarchical type so lessons can sit under courses.

ExampleA hierarchical “Course” type with Page attributes lets editors nest lessons under each course.

Resource libraries

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.

Custom post type tips

Avoid the common problems

Flush permalinks once

New post type URLs return 404 until rewrite rules are refreshed. Visit Settings → Permalinks and click Save once after adding the code.

Put it in a plugin

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 Generator

Keep the key short and unique

Keys are limited to 20 characters and should be specific, like shop_product, to avoid clashes with other plugins.

Add matching templates

Create single-{key}.php and archive-{key}.php in your theme to control how items and listings look.

Exclude private types from search

Turn Public off for internal content like testimonials; the generated code then keeps it out of search and removes its URLs.

Use the Usage tab

The Usage tab gives a WP_Query loop and template file names for your post type, ready to paste.

Built & tested by

HemantInsights

Senior Software Engineer · Developer of Toolyconvert

Hemant developed WordPress Custom Post Type Generator and tests it on desktop and mobile with real files. He is a senior software engineer from Dehradun, India, building websites since 2014, and designed and developed Toolyconvert end to end.

Last updated 30 September 2026

Answers and guidanceFrequently Asked Questions
Where do I put the generated code?
In a small custom plugin (recommended) or in your theme’s functions.php. The code registers the post type on the init hook, so it works from either place.
Why do my new post type pages show 404?
WordPress needs to rebuild its rewrite rules. Go to Settings → Permalinks and click Save Changes once.
What is the difference between the key and the URL slug?
The key (max 20 characters, e.g. product) is used in code and queries. The URL slug (e.g. products) is what appears in the address bar.
How do I enable the block editor for my post type?
Keep Show in REST switched on and include the Editor feature. Without Show in REST, WordPress uses the classic editor.
What does hierarchical mean?
Items can have parent and child items, like Pages. Turn on Page attributes too, so editors can choose a parent.
Can I add categories to my post type?
Yes. Turn on Custom taxonomy to generate a category-style (hierarchical) or tag-style taxonomy attached to the post type.
Why is my key rejected?
WordPress limits keys to 20 lowercase characters and reserves names like post, page, attachment and order. The generator flags these so the code does not fail silently.
How do I display the items on my site?
Use the archive page if enabled, or query them with WP_Query and post_type set to your key. The Usage tab shows a ready-made example.
Do I need a plugin like CPT UI?
No. The generated code does the same job without an extra plugin. CPT UI is handy if you prefer clicking to code, but the code is lighter and easy to version.
Can I add custom fields to my post type?
Turn on the Custom fields feature to use WordPress’s built-in custom fields box, or use a fields plugin such as ACF with your new post type.
How do I show the post type in navigation menus?
Public post types are available in Appearance → Menus automatically, and the archive page can be linked with a custom link to its URL slug.
What menu icons can I use?
Any Dashicon, such as dashicons-cart or dashicons-portfolio. The field suggests common ones, and you can type any Dashicon name.
More tools for your workflowRelated Tools

Featured on

Toolyconvert is listed on these product directories and launch platforms.