WordPress is a popular CMS, because it offers a lot of flexibility. Webmasters may define pages, posts, categories, tags, and format any of them with plugins, widgets, and CSS. Yet, sometimes the out-of-the-box settings from WordPress core or your theme don’t quite accomplish what you want to do. Custom post types are a great solution to doing more outside-the-box. So why use a custom post type in WordPress? Why choose a WordPress custom post type vs. page/post/category? It’s simple: use a custom post type in WordPress to expand your site’s capabilities.
Jump to Section:
- What is a WordPress post type?
- What is a WordPress custom post type?
- Why use a custom post type in WordPress?
- Real-life example of how I determined I needed a custom post type
Back to Basics: What Is a WordPress Post Type?
Basically, a post type is a kind of content. The official WordPress codex lists seven post types:
- Navigation menus
- Custom CSS
Posts and pages are the post types with which webmasters interact the most. Basically, posts house timely webmaster/visitor content whereas pages house timeless webmaster content. More on these below.
Attachments house WordPress media uploads from the Library.
Revisions log author changes to posts and pages.
Navigation menus define the primary navigational…
Custom CSS houses the webmaster’s “Additional CSS” input from the Customizer.
Changesets saves the Custom CSS post. This post type defines how to save edits while in Customizer, as well as when the user returns to a page, or when the webmaster switches themes.
Unless you’re a WordPress theme developer, you’re only interacting with post and page post types.
Post vs. Page
Custom post types can function either as a page or a post. Therefore, understanding the key functions and differences between them is important to determine which your custom post type should be.
On one hand, WordPress posts share timely content. Posts update often and provide a direct avenue for visitors to interact with your website and content.
Some unique characteristics to WordPress posts include:
- Encourage conversation via comments and social sharing
- Share noteworthy publish dates
- Exist within a flat hierarchy
- Group and separate a variety of content using categories and tags
- Sorted in reverse chronological order by default
- Customized using custom formats
On the other hand, WordPress pages share timeless content. Pages are static and rarely require updates. Because pages are static, conversations aren’t needed or helpful here.
Some unique characteristics to WordPress page include:
- Exist within a hierarchy that allows nested pages
- Group and separate a variety of content via parent and child pages
- Can collect and archive posts into a central location
- Customized using templates
Basically, WordPress posts and pages are opposites. However, the most important difference between them is whether their content is “timely” vs. “timeless.”
So What Is a WordPress Custom Post Type?
A custom post type is a user-defined post type. This post type is in addition to WordPress’s seven defaults above.
A custom post type can be anything but for the sake of knowing how to handle it, WordPress asks you define its behavior. Is the custom post type timely, conversive, and sorted by categories and tags? Then chose a post-like behavior. Or, is the custom post type timeless and hierarchical? In that case, chose a page-like behavior.
Popular examples of custom post types I’ve seen in WordPress themes include reviews, portfolios, testimonials, and products. Additionally, plugins also often introduce their own custom post types like sliders, tables, or forms. However, WordPress users are free to make something else.
I’ve discussed working with custom post types previously on my blog when discussing CPTs making them manually or with Elementor Pro, or hiding them from WordPress’s Categories widget. You can read about how to make a WordPress custom post type in either of the first two technical tutorials.
But before you make a WordPress custom post type, you might be curious as to why use a WordPress custom post type at all. At what point is it better to make the switch from a post or page post type to a custom post type?
Why Use a Custom Post Type in WordPress?
There’s actually several reasons why a custom post type in WordPress is useful. You might need to use a custom post type in WordPress when you need:
- To display that content differently*
*And that content only vs. changing how all posts or pages display sitewide
- Additional fields to input content
- Specific permalink structure
- A content series that doesn’t need to be chronological
The reasons behind these uses might be aesthetic, semantic, SEO, or functional.
For example, “You need to display that content differently” can be driven by aesthetic need. Another example, “specific permalink structure” can require use of a much-needed keyword. Finally, “additional fields to input content” can be functional.
Of course, there’s also overlap. It’s likely your custom post type is driven by multiple needs.
Display Content Differently
One reason to use a custom post type in WordPress the need to display content differently. Sharing post types results in displaying both kinds of content in the same format. This format is defined by one, shared PHP template within the theme’s back-end. Consequently, big modifications are difficult if not impossible to accomplish on the front-end alone.
For example, differing treatments of sidebars, widgets, widget content, number of items to display, columns and layouts, and more are format modifications that stretch the limitations when trying to avoid using a custom post type.
Defining a custom post type allows you to establish a new, custom template for your new kind of content.
Additional Fields to Input Content
One of the most popular plugin for adding custom input fields, Advanced Custom Fields, doesn’t require a custom post type to use. However, ACF and CPTs do tend to go hand in hand.
Often, ACF is introduced when an existing post type format fails to include everything the custom content needs. Furthermore, the post type’s PHP template needs updating to display the ACF input on the actual web page. Yet, it’s rare that it’s safe to overwrite the default template and assume it won’t be needed later. Therefore, additional fields to input content often require new, custom templates, and custom post types indicate to WordPress to treat these items differently.
A Specific Permalink Structure
By default, a page’s URL is the page title. Likewise, a post’s default URL is commonly a date followed by the post title. Making changes to either of these using the WordPress dashboard results in a sitewide change.
However, custom post types allow webmasters to define different permalink structures for only some posts and/or pages instead of sitewide. While WordPress permits a custom permalink structure, it only recognizes the available tags listed and further applies changes sitewide, to all post and content types.
Additionally, using a custom post type to assist with custom permalink structures allows useful URLs that include CPT taxonomies such as http://example.com/recipes/breakfast,brunch/egg-dish-title/ (source).
While we’re discussing modifying permalinks, notice key differing opinions. Yoast SEO advocates removing dates from permalink structures since they serve little SEO purpose and can lead people to believe older content loses relevancy when it may not. Yet, WordPress advocates preceding posts with some kind of number for best performance, an issue Chris Coyier of CSS-Tricks experienced first-hand in 2017. If your website is making an enormous number of time-consuming database queries, consider adding a post ID or date to the permalink.
Content Series that Doesn’t Need to Be Chronological
Using a custom post type in WordPress to order a post content series that doesn’t need to be reverse chronological.
WordPress orders post post types in reverse chronological order by default. Re-ordering requires publish time edits, plugin downloads, PHP modifications, or a custom post type. Like displaying content differently or writing different permalink structures for different content, custom post types also help re-order only some kinds of content but not all.
This is handy when you want to order posts chronologically, alphabetically, or randomly. For example, blog posts display in the standard reverse chronological order, a book custom post title displays in ascending alphabetical order, and a pillar page series in chronological order.
Real-Life Example of How I Determined I Needed a Custom Post Type
For example, my theme’s out-of-the-box settings didn’t include something like a portfolio post type. Yet my website’s primary purpose is to act as a portfolio.
There’s a lot of work-arounds to avoid the work of making a custom post type. I might have worked within the theme’s blog posts to create case studies, my long article portfolio items.
However, the workarounds can create messy work in other ways too that result in bloatware, increased maintenance, or settling for universal formats.
Here’s my thought process for determining why to use a custom post type in WordPress.
Reasons Why a CPT Was Needed
I found making my own Case Study custom post type was necessary for the following reasons:
- I wanted characteristics from both posts and pages
- I still wanted to make blog posts too
- It didn’t make semantic sense to call my Case Studies “blog posts” because they’re a different format from blog posts
- I wanted a custom taxonomy of categories
- I wanted to display my content differently, such as removing the sidebars, author box, and “View related” items from my Case Study pages without removing them site-wide
In some ways, the Case Study custom post type behaved like a post. The Case Studies would be mostly flat in hierarchy; they wouldn’t ever need to nest within each other. Also, they would use categories (but not tags). Furthermore, the Case Studies go together as a collection of similar content.
Yet in other ways, the Case Study custom post type behaved like a page. Once I publish a Case Study, it doesn’t need updating. (Of course a blog updates frequently, but consider how a blog post updates dynamic content or amends outdated information.)
Limitations of Existing Post Types
If I tried to work the Case Study custom post type into the existing blog posts, I needed to consider several obstacles:
Firstly, making case studies unique pages doesn’t allow me to assign categories.
Secondly, case studies and blog posts display together and mixed.
Thirdly, re-ordering options are reduced to reverse chronological and “sticky”—while the content is still mixed together—and consequently promote the visibility of one content kind at the expense of the other.
Finally, both case studies and blog posts would struggle to adapt to the exact same formatting—same input field when drafting the page, same sidebar arrangement, same widgets, same everything.
What Avoiding a Custom Post Type Might Look Like to Accomplish the Same or Similar
- Assign each content kind a parent category (e.g. “Blog” vs. “Case Study”)
- Assign and nest every new category under one of the parent categories
- Download an additional plugin to query based on one of these parent categories before displaying them
- Maintain this additional querying plugin
- Reduce sidebar and widget to content that’s universal to both “Blog” and “Case Study”
- Download another plugin to manually change sidebar and wrapper settings for each and every “Case Study” page
- Redo or copy-and-paste custom editor formats from a “Case Study” page to subsequent pages
- Accept that every “Case Study” permalink precedes with a date (or else disable this structure sitewide, “Blog” included)
- Manually add an identifying prefix “case-study” to each “Case Study” permalink
As you can see, a lot of consideration went into why I needed to use a custom post type in WordPress. Individual items might have had work-arounds but satisfying the whole list of requirements would be difficult. Additionally, the work-arounds might simply be inefficient or less than best practice.
Ultimately, though, custom post types in WordPress aren’t difficult to make—just a tiny bit of PHP!—and this allows your website to obtain more functionality and maximize efficiency.