Have you noticed menus like Products, Events or Portfolio in some WordPress dashboards? These come from a custom post type. It is a content type you add to WordPress, apart from the default posts and pages, to keep a special kind of content separate.
What is a Custom Post Type in WordPress?
Inside WordPress, almost everything you create is stored as a "post" with a type. Blog posts, pages, media attachments, revisions and navigation menu items are all built-in post types. A custom post type is nothing but a new type that you register for your own content.
Think of it like a filing cabinet with separate folders for bills, letters and receipts. For example, WooCommerce registers a product post type, so products never mix with your blog posts.
Why Use Custom Post Types?
- Each type gets its own menu and screens in the dashboard, and its own URLs on your site.
- You can give it custom fields, its own taxonomies and its own templates.
- Your blog page stays clean, because custom post types don't appear there by default.
- They are also left out of your main feed, but you can add custom post types to the main WordPress RSS feed.
How to Create a Custom Post Type
Beginners can use a free plugin like Custom Post Type UI and simply fill in a form. Developers usually register one with the register_post_type() function, hooked to init:
function wpt_register_books() {
register_post_type( 'book', array(
'label' => 'Books',
'public' => true,
'has_archive' => true,
'show_in_rest' => true,
) );
}
add_action( 'init', 'wpt_register_books' );
Setting show_in_rest to true lets you use the block editor for this type. For the full process, read our guide on how to create a custom post type in WordPress.
If your new post type shows a 404 error, go to Settings → Permalinks and click Save Changes. This refreshes the rewrite rules.
Also, register it in a plugin rather than your theme. If you switch themes, the content stays in the database, but it disappears from your dashboard.
Custom post types keep different kinds of content neat and easy to manage. Try creating one on a test site, and you will see how useful they are. Any questions? Drop them in the comment section below.