Custom Post Types in WordPress 101

Written by WordPress Expert

July 5, 2022
Custom Post Types in WordPress 101

Out of the box, WordPress is a powerful content management system. You can create any type of website, for whatever you need, whether it be for a brick or mortar business, affiliate marketing, blogging, ecommerce, portfolio, and more. Because of its versatility, WordPress has become the number one CMS in the world, with more than 43% of websites online powered by it. Part of the success is because of custom post types. In this article, you’ll learn about custom post types in WordPress.

What is a Custom Post Type?


In version 3.0 "Thelonious" of WordPress, custom post types were introduced.

A custom post type is a tool intended to extend the functionality of WordPress beyond just the default post and pages. However, there are more than just pages and posts that fall under custom post types.

The following are post types:

  • Posts

  • Pages

  • Navigational Menus

  • Attachments

  • Revisions

Posts

Posts are non-hierarchical, displayed in order of latest published post being first. Most people use posts for their blog or news section of their website.

Pages

Pages are different from posts in a way that you can add a hierarchy to them, or even display only one page. This post type is usually good for static content that may be important areas of your site, like your services pages, or contact page.

Navigational Menus

Navigation menus are separate in a way that you can organize and display posts or pages, or other custom post types in any manner you desire.

Attachments

The attachment post type is normally associated with what you upload to your media library, whether it be an image, audio file, PDF, or even video.

Revisions

The revision post type allows WordPress to store previous versions of any post type, in the case you need to restore it. You can also compare current and previous revisions to each other.

Anything outside of these default WordPress post types would be considered custom post types. They can be classified as any of the default post types, but must be named differently, in order to keep them separated. For example, if you wanted to build a portfolio, then you might want it to act similar to a page, but you will want to name your custom post type as “portfolio”.

Why would you need a custom post type?


Custom post types can be used to turn your website from a simple one that allows blogging, to:

  • Event Calendars

  • Real Estate Listings

  • Directories

  • Portfolios

  • Forums

  • Testimonials

  • Quotes

  • News outlet

… and much more!

In fact, there are many plugins in the WordPress plugin directory that add custom post types to achieve some of these types of sites, like:

These types of plugins are designed to remove some of the legwork of creating a custom post type, but also providing design and other functionalities.

How to create a custom post type in WordPress using a plugin?


While you could create custom post types by adding some code to your WordPress theme’s functions.php file, there’s an easier way to do that - with a plugin. Why use a plugin? Well, a plugin will allow you to organize your custom post types and keep it separate from your theme. If you end up changing your theme at a later time, then you have to remember to copy and paste the custom post types code to your new theme’s function.php file.

  • Install Custom Post Types UI

  • Name your custom post type

  • Add attributes to your custom post type

  • Adjust your custom post type’s settings

  • Add taxonomies to your custom post type (optional)

Step 1. Install Custom Post Types UI

Custom Post Types UI

There are a lot of custom post type plugins, but the one you’ll be using for this tutorial is the Custom Post Types UI plugin. Just go to your Plugin section of your WordPress admin and add a new plugin.

Custom Post Types UI plugin

Step 2. Name your custom post type

Naming custom post type

Your post type label or slug should not be named “post”, “page”, “attachment”, “menu”, or “revision”, as these already exist in your WordPress installation. The slug refers to what the end URL will be used for your custom post type, and the labels will be used for the area in your WordPress admin that you’ll be adding content to.

For this tutorial, we can add a “portfolio” in the slug field, “Portfolio” for the Plural Label, and then “Portfolio” for the Singular Label. Unlike the “Movies” suggestion in the Plural Label, you may find some custom post type labels may be the same. You can click the Add Post Type button, or scroll down to the area under it to add attributes.

Step 3. Add attributes to your custom post type

This step has a lot of areas to go through, that deal mostly with how your custom post type will look in your WordPress admin area.

Add attributes to custom post type

You’ll want to add your post type description and then start adding your menu name. The Custom Post Types UI plugin gives a great prompt on how to handle your additional labels and attributes. In the odd case of using Portfolio, more than likely for All Items, you’d use “Portfolio Items”, and for Add New, you’d want to use the label “Add New Portfolio Item.

Add New Portfolio Item

Again, in this section you’re merely adding the appropriate labels so it looks right in your WordPress admin. The plugin will do all the fun magic of inserting your labels into the appropriate areas of your new custom post type.

Add attributes to custom post type 3

Even though there are a lot of fields, it’s important to fill out these areas as much as possible, especially if you’re not the only one using the website, once the custom post types in WordPress are created.

Add attributes to custom post type 4
Add attributes to your custom post type 5

You’re probably reeling a little after adding all the label attributes from the previous step, but there’s more to do.

Step 4. Adjust your custom post type’s settings

Your custom post type’s settings are super important, as this step determines how it will function. You’ll want to tell the plugin whether you want people to see your custom post type in the WordPress admin area, and if it can be searched. In some cases, you may want to leave the default selection. Make sure to go through your custom post type settings carefully.

Adjust your custom post type’s settings

If your custom post type requires any special applications, like the Rest API, you can adjust your custom post type to include support for it.

Adjust custom post type’s settings 2

You will want to make sure whether you want your custom post type to be included in front end search, and whether you want it to behave like a post or page. If you’d like it to be like a page, add “page”. Because pages usually allow for you to add a parent-child relationship, or hierarchy, you can opt to choose “True” for in the Hierarchical system. It’s okay if you don’t want to offer this option too.

Adjust custom post type’s settings 3

You will want to give your custom post type a spot in your WordPress admin sidebar navigation. The lower the number, the more your custom post type is toward the top of your navigation.

You might also want to add a Dashicon for your menu item or add your own.

Adjust custom post type’s settings 4

Most of this section of your custom post type settings, you leave default, unless you want to give your custom post type its own type of search. This is good if you want to do Real Estate sites, and want to set the property listings search separate from the rest of your site.

Adjust custom post type’s settings 5

It’s important that you check the boxes in the areas you want your custom post type to support. These will be areas like your content editor, title, featured image, and whether you allow for custom fields.

Adjust your custom post type’s settings 6

In most cases, for your new custom post type, if you want to add categories and tags, you will not check any of the boxes in the Taxonomies settings. You will want to add new taxonomies.

Step 5. Add taxonomies to your custom post type (optional)

Taxonomies in WordPress allow you to designate specific data to a group. The most common way to do this is through using categories and tags. Categories are best used for very wide and general topics, while tags are for very specific topics.

Add taxonomies to custom post type

When creating your taxonomy, you will want to make sure you add it to the custom post type that you want it to be associated with.

Add taxonomies to custom post type 2

You’ll want to add your new taxonomy’s labels. In the case of Portfolio you might use “Portfolio Category”, rather than just Portfolio. The plugin’s default field examples are a good guide to follow along, as you fill out how you want your labels for your taxonomies to look.

Add taxonomies to custom post type 3
Add taxonomies to custom post type 4
Add taxonomies to your custom post type 5

Once you’ve filled out the labels for your taxonomies, there’s some settings you will need to adjust too.

Add taxonomies to custom post type 6

Just like the settings in your custom post type, your custom taxonomies have options whether you wish your custom category or tag be public and searchable in your WordPress admin area.

Add taxonomies to custom post type

In most cases, you may want to use the default selection for your custom taxonomies.

Add taxonomies to custom post type 8

If your taxonomies for your custom post type use the WordPress Rest API, you can adjust your settings for them too.

Add taxonomies to your custom post type 9

Once you’ve created your taxonomy, your custom post type should be ready to use!

Display Custom Post Types in WordPress


Phew! That was a lot of work just creating your custom post types in WordPress, right? Well, you think you may be done, but you may want to customize or display your custom post types on the front of your site. By default, your WordPress theme can handle displaying your custom post type, but it will display like a post or page, depending on how it was set up.

If you want it to display differently from your default post types, you may need to build some custom post type theme templates or use a plugin like Content Views. The free version of this plugin allows you to display your posts in a grid format, which is great if you’ve added a Portfolio custom post type.

In Summary


Now that you know about custom post types in WordPress, you can either dive deep in learning the code, or use the plugin method to extend your website. The possibilities are endless with custom post types, so have fun trying it out for your next website project!

Frequently Asked Questions

Can I control what my users post?

Yes, your system administrators can monitor posts and content to ensure it’s suitable. Plus, you can download various monitoring tools that will filter posts for bad language and unsuitable content. It’s up to you how much freedom you give to your users.

What should I post on my mom blog?

Mommy blog topics to consider are homemade baby food, breastfeeding, co-sleeping, babywearing, working mom, mom of multiples, sewing baby clothes, dating after divorce, marriage tips, homeschooling, child photography, family travel, kids’ books, kids’ crafts, and many more.

What to post on fashion blog?

Things that usually get posted on fashion blogs include a wardrobe tour, your bag collection, shoe collection, jewelry collection, your most worn items, outfit of the day, your favorite online fashion stores, and so on.

Why choose Verpex for WordPress?

As the leading CMS out there, we’ve made it our mission to offer the most comprehensive and streamlined WordPress solutions on the market. Backed by a responsive customer care team and reliable site enhancement tools, we ensure our users get the full WordPress value and support for a reasonable price.

Jivo Live Chat