WordPress is often thought of as a simple blogging platform—but under the hood, it’s a powerful CMS. One of the key features that give WordPress this power is the ability to create Custom Post Types and Custom Taxonomies.
If you’ve ever wanted to go beyond posts and pages—like adding portfolios, testimonials, or product listings—Custom Post Types (CPTs) and Taxonomies are the tools you need.
In this article, we’ll explain what they are, why they matter, and how to implement them.
What Are Custom Post Types?
WordPress comes with a few built-in post types:
- Posts
- Pages
- Attachments
- Revisions
- Menus
Custom Post Types allow you to create your own content types. For example:
Portfoliofor showcasing workTestimonialsfor client feedbackMovies,Books,Recipes, or any content-specific structure
These behave just like posts but can have unique templates, fields, and taxonomies.
What Are Custom Taxonomies?
Taxonomies help you organize your content. WordPress has:
- Categories (hierarchical)
- Tags (non-hierarchical)
Custom Taxonomies let you group your Custom Post Types in ways that make sense for your content.
Example:
- If you create a “Movie” post type, you could create a taxonomy called
GenreorDirector.
How to Register a Custom Post Type
You can add CPTs via a plugin (like Custom Post Type UI) or with code:
function create_movie_post_type() {
register_post_type('movie',
array(
'labels' => array(
'name' => __('Movies'),
'singular_name' => __('Movie')
),
'public' => true,
'has_archive' => true,
'rewrite' => array('slug' => 'movies'),
'supports' => array('title', 'editor', 'thumbnail'),
)
);
}
add_action('init', 'create_movie_post_type');This code adds a new “Movies” section to your WordPress admin menu.
Register a Custom Taxonomy
Here’s how you can register a taxonomy called “Genre” for your Movie CPT:
function create_movie_taxonomy() {
register_taxonomy(
'genre',
'movie',
array(
'label' => __( 'Genre' ),
'rewrite' => array( 'slug' => 'genre' ),
'hierarchical' => true,
)
);
}
add_action( 'init', 'create_movie_taxonomy' );
Why Use CPTs and Taxonomies?
- Organized Content: Structure your site better by separating different types of content.
- Better SEO: Separate URLs and archives for different content types.
- Improved UX: Visitors find what they’re looking for more easily.
- Custom Templates: You can build different layouts for each content type.
Template Support
WordPress allows you to create specific templates for your CPTs:
single-movie.phpfor individual movie pagesarchive-movie.phpfor the movie archive
Just drop these into your theme folder to customize the look.
Pro Tips
- Use Advanced Custom Fields (ACF) to add more fields to your CPTs.
- Combine with Gutenberg blocks to create powerful editing experiences.
- Always flush permalinks after registering a new CPT (go to Settings > Permalinks and click Save).
Final Thoughts
Custom Post Types and Taxonomies open up endless possibilities in WordPress. Whether you’re building a portfolio, directory, or a custom app-like site—CPTs let you structure content in a way that fits your needs.
Now that you know how they work, go ahead and try creating your first one!
