In WordPress, custom post types are used when you want to create content that’s different from a normal post or page.
For example, you can create custom post types for portfolios, testimonials, and products. Many WordPress plugins also use custom post types to store data.
If you decide to use custom post types on your website, then you will need to learn how to create them and display them on your site. You will also need to add them to your search results and decide how to organize them.
What Is a Custom Post Type?
WordPress comes with a few different post types by default:
- Nav Menu
You can also create your own post types, and these are known as custom post types.
For example, you could create custom post types for portfolios, testimonials, and products. A movie review website could have a ‘movie reviews’ post type.
- WooCommerce adds a ‘product’ post type to your online store
- WPForms creates a ‘wpforms’ post type to store all your forms
- MemberPress adds a ‘memberpressproduct’ custom post type
When Should You Use Custom Post Types?
You can often use built-in WordPress features such as categories and tags to organize your content without needing to use custom post types. For example, you can set up a hierarchical layout of content using child pages and also set up subcategories.
Using these default WordPress features is often easier since by default custom post types won’t appear on your blog page, in search results, or in your RSS feeds.
After looking at the default options, you may find that you don’t need custom post types after all. If you are unsure, then refer to this guide about when you need a custom post type or taxonomy in WordPress.
How to Create a Custom Post Type in WordPress
If you decide to use custom post types on your blog, then the easiest way to create them is with a plugin. The Custom Post Type UI plugin is recommended for most users, and lets you create custom post types from the ‘Edit/Add Post Types’ page.
Alternatively, you can add a custom post type by pasting a code snippet into your theme’s
functions.php file. The advantage of this method is that your custom post types won’t disappear if the plugin is deactivated.
You can learn more in our guide on how to create custom post types in WordPress.
How to Display Custom Post Types in WordPress
You can also use Custom Post Type UI to display your custom post types on your website.
Displaying Custom Post Type Archive Pages
Before you can view the archive page for your custom post type, you must make sure that archives are enabled for your custom post type.
If they are not, then you can enable them in Custom Post Type UI’s advanced options.
If you have SEO friendly permalinks enabled, then you can visit your custom post type archive at a URL like this one:
You will have to replace ‘example.com’ with your own domain name, and ‘movies’ with your custom post type name.
Displaying Custom Post Types on Your Navigation Menu
Now that you know the URL of the archive page, you can add it to your navigation menu. You can also customize the archive page by adding a custom template to your WordPress theme or using a theme builder like SeedProd.
We show you how to do all of these things step by step in our guide on how to create a custom post types archive page in WordPress.
Displaying Sticky Custom Posts
Finally, if you would like to pin your most important custom posts to the top of the page, then you can follow our guide on how to add sticky posts in WordPress custom post type archives.
How to Search Custom Post Types in WordPress
By default, WordPress won’t show custom post types in its on-site search results. That means your visitors may miss out on some great content, and you’ll miss out on extra page views.
Including Custom Post Types in Search Results
The easiest way to include custom post types in WordPress search is with the SearchWP plugin. Simply click on the plugin’s ‘Sources & Settings’ button. Here you can put a checkmark next to each post type you wish to include in search results.
You can also choose how important each custom post type is when displaying search results, and customize the search engine in other ways.
To learn how, see our step by step guide on how to include custom post types in WordPress search results.
Creating a Search Form for Custom Post Types
You can also use SearchWP to create a custom search form that will only show results from your custom post type, then add the form to your posts or sidebar.
For example, if you have a custom post type called ‘movies’, then you can create a special movie search form that only returns movies in the search results.
For more details, see our guide on how to create an advanced search form in WordPress for custom post types.
How to Organize Custom Post Types in WordPress
By default, you won’t have a way to organize your custom post types. WordPress categories can only be used to organize posts, not custom post types.
Adding Categories to a Custom Post Type
Luckily, you can use Custom Post Type UI to associate categories with custom post types.
Simply check the ‘Categories (WP Core)’ box in the plugin’s ’Taxonomies’ area and you will be able to use categories to organize your custom post types.
Learn more in our guide on how to add categories to a custom post type in WordPress.
Creating Custom Taxonomies for a Custom Post Type
Alternatively, you can create a new custom taxonomy to organize your custom post type. For instance, if you have a custom post type called ‘Books’, then you can sort it using a custom taxonomy called ‘topics’.
Then you can add topic terms like Adventure, Romance, Horror, and other book topics. This would allow your readers to easily sort books by each topic.
Get started by following our guide on how to create custom taxonomies in WordPress.
How to Subscribe to Custom Post Types in WordPress
WordPress only includes your blog posts in your site’s main RSS feed. This means your custom post type content won’t be visible to your main RSS feed subscribers.
For more detail on both methods, see our guide on how to add custom post types to your main WordPress RSS feed.
Alternatively, you may want to learn how to make a separate RSS feed for each custom post type in WordPress.
We hope this article helped you learn more about custom post types in WordPress. You may also want to see our Additional Reading list below for related articles on useful WordPress tips, tricks, and ideas.
- How to Create Advanced Search Form in WordPress for Custom Post Types
- How to Create Custom Post Types in WordPress
- How to Add Categories to a Custom Post Type in WordPress
- How to Include Custom Post Types in WordPress Search Results
- How to Create a Custom Post Types Archive Page in WordPress
- How to Make a Separate RSS Feed for Each Custom Post Type in WordPress
- When Do You Need a Custom Post Type or Taxonomy in WordPress
- How to Add Custom Post Types to Your Main WordPress RSS Feed
- How to Create Custom Taxonomies in WordPress
- Post Types