Originally published: December 23, 2021 · Last updated: August 13, 2026
Custom post types are one of the most useful ways to structure content in WordPress when ordinary posts and pages are not enough. They let you create dedicated content types such as Projects, Artists, Reviews, Events or Products while keeping their fields, archives and templates separate from the main blog.
When a custom post type makes sense
Use a custom post type when the content has a distinct purpose and will contain multiple entries with a repeatable structure. A portfolio with dozens of projects, for example, is easier to manage as a Project post type than as a collection of unrelated pages.
Do not create a custom post type simply because you want a different visual layout. If the content is fundamentally a normal page or article, a template may be enough.
Plugin or code?
Both approaches are valid. A visual tool such as Meta Box, Pods or Custom Post Type UI is convenient for site builders. Developers can register a post type directly with WordPress using register_post_type().
The important architectural rule is that the post type should normally live in a plugin or must-use plugin, not in the active theme. If you switch themes, your content structure should not disappear with it.
A minimal code example
<?php
add_action( 'init', function () {
register_post_type( 'project', [
'labels' => [
'name' => 'Projects',
'singular_name' => 'Project',
],
'public' => true,
'has_archive' => true,
'show_in_rest' => true,
'rewrite' => [ 'slug' => 'projects' ],
'supports' => [ 'title', 'editor', 'thumbnail', 'excerpt' ],
] );
} );
The key project is the internal post-type identifier. WordPress requires post-type keys to stay within its length and character rules. The show_in_rest argument is especially useful because it makes the post type available through the REST API and compatible with the block editor.
Think about the data model before creating fields
A custom post type is only one part of the structure. Before adding dozens of custom fields, decide which information belongs in the main editor, which values need dedicated fields, and which should be taxonomies.
For example, an Artist post type might use:
- the post title for the artist name;
- the main editor for the biography;
- custom fields for website and social links;
- a taxonomy for discipline or country;
- the featured image for the main portrait.
This is usually cleaner than storing every piece of information as free text.
Templates and archives
Once the post type is registered, WordPress can display single entries and an archive. A theme can provide dedicated templates such as single-project.php and archive-project.php, while page builders and block themes can also create templates visually.
If a newly created archive returns a 404, flushing permalink rules once from Settings → Permalinks can help after registration changes. Do not flush rewrite rules on every page load in code; that creates unnecessary work.
Custom post types are not categories
A common design mistake is using separate post types for things that are really classifications. If “Photography”, “Painting” and “Sculpture” all contain the same kind of artist record, they probably belong in one Artist post type with a Discipline taxonomy rather than three separate post types.
Plan for portability
Before building a large content system, document the post type key, taxonomies, custom fields and permalink structure. This makes future migrations, theme changes and API integrations much safer.
Official references: WordPress post types and register_post_type().