How to create custom post types in WordPress (step-by-step)

How to create custom post type with plugin

Every WordPress site comes with the default post and page post types. While they are enough for small websites, they are not ideal for large sites. This is where the WordPress custom post type comes in. In this article, I’ll lay down a step-by-step guide to creating, managing, and displaying custom post types easily.

A Post Type is essentially a way to categorize your website's content into distinct and meaningful groups. Whether it's your blog posts, portfolio projects, events, products, or anything else, you can create and use custom post types to specifically cater to each type of content. This makes it easier for you to manage and display your content in a more organized and meaningful way. With the ability to create custom types, WordPress evolves from just a basic blogging platform to a powerful Content Management System (CMS) that can be customized to meet the needs of any website.

No doubt, custom post types are helpful, but they can be a bit confusing to some. On top of that, custom fields and taxonomies can further complicate things for new users but don't worry. By the end of this custom post type WordPress tutorial, you'll have a clear understanding of WordPress custom post types, taxonomies, and fields. You'll know how to create a post type in WordPress with the free Easy Post Types and Fields plugin, and how to display them on your website with Posts Table Pro.

preview custom post type content
A custom post type (movie reviews) displayed using Posts Table Pro.

Let’s start by answering this question.

What are WordPress custom post types?

Since WordPress is a super flexible content management system, it relies heavily on post types. Think of post types as buckets of information where website owners can store and organize their custom content. Each bucket/post type is different from others in nature and is built to serve a different purpose.

WordPress itself comes with a couple of default post types.

  • Page
  • Post
  • Media
  • Attachments

Post types such as page and post are set up automatically with every website, and you can use them to differentiate blog post content from web page content. Some plugins and themes also come packaged with their own post types such as the 'Product' post type that is automatically installed with WooCommerce for building eCommerce websites.

You can also create your custom post type (CPT) to organize the website's custom content more strategically. For example, if you have a book review website, you can use the ‘posts’ post type to write your movie reviews, but if you want to do it effectively, you should create a ‘Movie reviews’ post type and organize all your movie reviews there.

At Barn2, we use Knowledge Base and Showcase custom post types to keep those two content types separate from our tutorials and keep our content more organized.

To further structure the content, every custom post type can have custom taxonomies and custom fields.

Custom Taxonomies

Custom taxonomies are a crucial aspect of organizing content on any WordPress website. They allow you to categorize and group similar posts or content items under a specific taxonomy. This can be incredibly useful when it comes to managing and navigating through your website's content. For instance, if you have a book review website, you can create a custom taxonomy called 'Book Genre' to categorize your reviews into different genres like Thrillers, Mystery, Fiction, Self-help, and so on.

Moreover, custom taxonomies can also be hierarchical in nature, meaning you can further divide your content into subcategories. For example, in the self-help category, you can create sub-divisions for biographies, health, success, and more. This makes it easier for your visitors to find the content they're looking for, and also helps to keep your website organized and structured.

Custom Fields

Custom fields, as opposed to custom taxonomies, store additional information specific to individual posts or pieces of content. Rather than serving as a way to organize data, custom fields serve to provide additional information about a particular post. For example, if you were running a movie review website and wanted to display movie ratings, you could add a custom field of type standard text and then enter the ratings for each individual movie. in this way, custom fields are a powerful tool to enhance the information store in each post and provide a more comprehensive and in-depth representation of the data.

custom fields wordpress

By combining different post types, fields, and taxonomies, you can smartly organize the content on your website. Let’s see the different ways you can create custom post type WordPress on your website.

How to create a WordPress custom post type

Undoubtedly, custom content types play a crucial role in organizing the content on your website. Before you start creating custom post types, it's important to plan out the structure of your content.

While categories and tags can sometimes be sufficient for organizing your content, they may not always be the best solution. if your content is unique in nature and cannot be classified with other posts or custom content pieces, creating a custom post type would be a more appropriate solution. Hence, it's crucial to evaluate the nature of your content before deciding whether to use categories and tags or create custom post type WordPress.

With that in mind, broadly, you get two alternatives on how to create a post type in WordPress hosting site:

  • Creating custom WordPress post types with a free plugin (for non-developers)
  • Creating custom WordPress post types with code (for developers)

Let’s take a look at both of them individually.

Creating custom WordPress post types with a free plugin (for non-developers)

When it comes to creating a custom post type, using a WordPress custom post type plugin can significantly simplify the process. This is especially true if you are not a developer or have limited coding knowledge. With the help of a plugin, you can set up your custom post type in a matter of minutes, without having to delve into the complex things.

The use of a CPT UI plugin is also convenient for developers. While they could certainly create a custom post type manually, using a plugin streamlines the process and saves time. There are many plugins available in the WordPress repository, and one such plugin is Easy Post Types and Fields. This plugin is free and user-friendly, and even novice users can easily create and add post type WordPress with its help.

Easy post types and fields plugin

With the Easy Post Types and Fields plugin, even a non-technical person can create custom post types in WordPress, create custom taxonomies, and custom fields effortlessly. The plugin has a user-friendly step-by-step guide to making the process of creating custom post types, taxonomies, and fields easy and seamless.

The plugin is an excellent solution for those who are looking for a cost-effective and easy way to manage custom content on their WordPress website.

If you'd rather watch a video, you can check it out here:

Installing the Easy Post Types and Fields plugin

To create custom post type in WordPress, we need to first install the Easy Post Types and Fields plugin. Here’s how you can do it:

  1. In your WordPress admin area dashboard, go to Plugins → Add New.
  2. If you haven’t downloaded the Easy Post Types and Fields plugin, you can download it here from wordpress.org. Click on the Upload plugin button and upload the file.
  3. Click on the Install button and once the installation is done, click on the Activate button.

Once the plugin is activated on the website, the setup wizard will be loaded automatically. The wizard will help you create a custom post type easily.

If you already have the plugin installed on your website, you can launch the wizard by going to Post Types → Manage and clicking on the Add New button.

Creating custom post type with the wizard

Firstly, you need to give your custom post type a singular and a plural name and click on the Next button. For example, if you are creating a movie review custom post type, the names can be:

  • Singular name: Movie Review
  • Plural name: Movie Reviews
custom post type wizard

Now select the information/attributes you need for your custom post type. Simply select the checkbox for the features you will use and click on the Create button.

And that's it! You've successfully created your first custom post type.

Wizard complete for custom post type

You can also go back and adjust these settings later and if you wish to add an option to store particular data, you can add custom fields to the post type to store information individually.

Now that you have your custom post type ready, you can locate it on your WordPress dashboard’s left sidebar navigation.

custom post type in sidebar

To make the custom content types more organized, you can add custom taxonomies to the post type. I recommend checking out this guide on creating custom WordPress taxonomies.

If you wish to add custom fields to your post type, you can do the same with the Easy Post Types and Fields plugin in no time.

To add a custom field, go to Post Types → Manage. In the Action column, click on the Custom Fields button for the respective post type. Now click on Add New and enter the details of the new custom field, such as Name, Slug, and Field Type.

director custom post type
Adding a new custom post type, Director, for Movie Reviews post type

I added three custom fields to the Movie Reviews post type:

custom fields movies CPT

Adding content/posts to custom post type

Once you have everything set up, you can start adding and organizing content in a custom post type.

For this, in your WordPress dashboard, hover over the post type name and click on Add New. Enter the details for your post type and select the respective taxonomies to organize the content.

Repeat this process for every new post, and once you are done, you can view the posts in the custom post type by clicking on the Post Type name in the WordPress dashboard. The content/pages for the post type I created for this tutorial (Movie Reviews) look like this:

Movie reviews custom post type data

With add post type WordPress in the backend, it’s time to display them on your website’s front end.

Creating custom WordPress post types with code (for developers)

Creating custom post types in WordPress can also be accomplished by writing custom codes. This process is commonly referred to as "manual creation" because it involves writing and injecting PHP and custom CSS codes to create your custom post in WordPress. To get started, you'll need to know how to write code, understand the functions.php file, and be familiar with the default WordPress API and args. If you don’t know how to do this then you should either use a plugin or hire a developer to do it for you. For example, Codeable provides a network of experienced developers for you to choose from.

Here are the steps to create a custom post type in WordPress without using a plugin:

  1. Open the functions.php file of your WordPress theme and add the following code.
    function create_custom_post_type() {
    
    register_post_type( 'custom_post_type',
    
    array(
    
    'labels' => array(
    
    'name' => __( 'Custom Posts' ),
    
    'singular_name' => __( 'Custom Post' )
    
    ),
    
    'public' => true,
    
    'has_archive' => true,
    
    'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments' )
    
    )
    
    );
    
    }
    
    add_action( 'init', 'create_custom_post_type' );
  2. In the above code, replace "custom_post_type" with your desired custom post type name. Also, update the "labels" array with the desired name and singular name of your custom post type.
  3. Next, update the "supports" array to add or remove the fields that you want to display for your custom post type. For example, if you don't want to display the author field, you can remove it from the array.
  4. Save the changes to the function.php file and visit the WordPress dashboard. You'll see the custom post type under the Posts menu.
  5. To display the custom post-type content on the front end, you'll need to create a template file for your custom post type. You can do this by creating a new file with the name "single-custom_post_type.php" and adding the following code:
    <?php 
    
    get_header();
    
    while ( have_posts() ) :
    
    the_post();
    
    the_content();
    
    endwhile;
    
    get_footer(); 
    
    ?>
  6. Replace the "custom_post_type"  with your custom post type name in the above code.
  7. Save the changes and visit the custom post-type archive page to see the custom post-type content.

How to create a custom post type in WordPress programmatically?

To create a custom post type in WordPress programmatically, you will need to write code using the register_post_type function, which is part of the WordPress Core. This function takes an array of arguments to determine the properties of the custom post type, such as additional labels, descriptions, navigation menu icons, and more. In the case of the "Movies" custom post type, you can add even more options such as support for revisions, featured images, and custom fields, and associate it with a custom taxonomy. This way, you can create a custom post-type UI that has all the features and functionalities you need.

Here’s an example of how you can create a custom post in WordPress called “Movies” programmatically:

function create_movie_post_type() {

register_post_type( 'movies',

array(

'labels' => array(

'name' => __( 'Movies' ),

'singular_name' => __( 'Movie' )

),

'public' => true,

'has_archive' => true,

'menu_icon' => 'dashicons-video-alt3',

'supports' => array( 'title', 'editor', 'thumbnail' )

)

);

}

add_action( 'init', 'create_movie_post_type' );

In this example, the create_movie_post_type function is used to register the custom post and type and the add_action is used to attach the function to the init action hook, which is triggered when WordPress is initializing.

The register_post_type function takes an array of arguments that specify the properties of the custom post type. Some of the key arguments are:

  • labels: an array of labels for the custom post type, including the name and singular name.
  • public: a boolean value indicating whether the custom post type should be publicly accessible or now.
  • has_archive: a boolean value indicating whether the custom post type should have an archive page or not.
  • menu_icon: the icon to be used for the custom post type in the WordPress admin menu.
  • supports: an array of features that the custom post type should support, such as title, editor, and thumbnail.

By writing this code and adding it to your WordPress site, you can create a custom post type programmatically without the use of any plugins. However, it’s important to have a solid understanding of PHP and WordPress development to write this code and ensure it’s properly integrated into your site.

How do I create multiple custom post types in WordPress?

Creating multiple custom post types in WordPress is not much different from creating a single custom post type. You just need to repeat the steps multiple times to create different post types. Here is some step you can follow to create multiple custom post types in WordPress:

  1. Define the custom post type arguments: Just like creating a single custom post type, you need to define the arguments for each custom post type you want to create. These arguments include labels, descriptions, menu icons, and other related parameters.
  2. Register the custom post type: Once you have defined the arguments for each custom post type, you can register them using the 'register_post_type()' function. The function should be called multiple times, each time with different arguments for each custom post type.
  3. Save the code: The code should be saved in the theme's functions.php file or a custom plugin. You can also create a child theme and add the code there if you want to keep your custom post types intact even after theme updates.
  4. Check the custom post types: After saving the code, you can check if the custom post types are successfully created by visiting the WordPress dashboard and checking the Posts section. You should see your custom post types listed there.

That's it! By following these steps,  you can create as many custom post types as you need in WordPress. It is important to note that you should have a basic understanding of PHP and WordPress API to implement this process successfully. If you're not comfortable with coding you can use a WordPress plugin to create multiple custom post types.

Displaying custom post types with Posts Table Pro

The Easy Post Types and Fields plugin is an all-in-one solution that helps you build and manage custom post types, fields, and taxonomies without any difficulty. This plugin is designed with a user-friendly interface, which makes it easy for non-developers to create custom post types, taxonomies, and fields with ease. However, you still need a way to display that content to your website visitors. That's where Posts Table Pro comes into play.

Posts Table Pro is a powerful plugin that enables you to display any published website content in a structured, tabular format. With Posts Table Pro, you have complete control over the content you want to display custom post type category WordPress. For instance, if you have created a custom post type for movie reviews and you want to display the data for movie reviews, you can create a table that only displays the content of the movie reviews custom post type. This feature allows you to easily manage and display your custom post types and taxonomies to your website visitors in an organized and readable manner.

Additionally, Posts Table Pro comes with advanced features that can greatly enhance your website visitors' experience. The sort, filter, search, and order features can help your visitors navigate through a large amount of content with ease. These features can save visitors time and effort in finding the content they need.

With Posts Table Pro, you can display your new custom post-type content in a structured and organized manner, which makes it easy for visitors to find what they're looking for. In fact, you can create tables that only display the content of your own custom post type, allowing your visitors to see only the relevant information.

With these powerful tools at your disposal, you can create a website that is both visually appealing and user-friendly, ensuring a positive experience for all of your visitors.

Installing and activating Posts Table Pro

Before you can install the plugin, you need to download it. If you don't have Posts Table pro, you can get it here.

  1. Go to Plugins → Add New in your WordPress admin dashboard.
  2. Click on the Upload button and upload the Posts Table Pro zip file and install it.
  3. Once the installation is done, click on the Activate button.
  4. Enter the license key in the plugin settings page and activate the license.
  5. Follow the setup wizard instructions to create your first table.

Displaying custom post type data in a searchable table

When you install the plugin, a setup wizard will launch automatically to guide you through the process of creating your first table. However, if you already have experience with the plugin or just prefer to jump right in, you can create new tables anytime by going to Post Tables → Add New.

Steps for table creation are as follows:

  1. Begin by naming your table and selecting the post type you want to display. If you don't have a content type yet, you can create one using the free Easy Post Types and Fields plugin.
  2. Next, choose which movies or pages to include in the table. The options available will depend on the post type you selected in the previous step. For example, if you selected a post with custom taxonomy, the relevant taxonomies will be listed for you to choose from.
  3. Customize your table to your liking. You can choose which columns to display and in what order. To add a new column, select the column type from the dropdown menu and click "Add". You can also reorder the columns by dragging and dropping the sort icon or column heading.
  4. Add filters to make it easier for users to find what they're looking for. For example, if you've sorted your movie reviews by genre, you can add a filter for that. The filters appear as dropdowns above the table, and you can add as many as you like. Note that the available filter options will change depending on the post type you selected on the first page.
  5. Enable lazy loading to speed up the table's performance, even if it contains hundreds or thousands of items.
  6. Customize the sorting options for your table. Depending on whether you've enabled lazy loading, the available sort options will vary.
  7. Finally, the wizard will confirm that you've finished creating your table and provide instructions for inserting it onto your site.

With the plugin settings I set up, this is what the posts table looks like:

preview custom post type content

Inserting the table into your website

Once you have created your table, the next step is to determine where it should be displayed on your website. There are two ways to insert the table into your WordPress site:

  1. If you're using the Gutenberg block editor, you can easily add the table by selecting the 'Post Table' block and inserting the table directly from the block settings.
  2. Alternatively, you can copy the shortcode from the last page of the table builder or from the main Tables page in the Post Tables section of the WordPress admin. You can then paste this shortcode anywhere on your site where you want the searchable database to appear. This method allows you to place the table on any page, regardless of its topic or content.

Start creating custom post types today!

Custom post types can greatly help in efficiently organizing website content. With this guide, you too can create and display custom post-type content on your website effortlessly with a WordPress custom post-type plugin.

The Easy Post Types and Fields plugin is the best WordPress plugin for creating new post types, fields, and taxonomies for free. Anyone can organize content in custom post types with minimal settings and options.

To display custom posts type content on the website's front end, the Posts Table Pro is the perfect tool. Apart from just listing, you can also organize, sort, filter, and granularly control what is displayed to the visitors. With the Posts Table Pro plugin, you can:

  • Display posts, pages, or any other custom post types in tabular format.
  • Show content based on custom fields and taxonomies.
  • Allow visitors to filter, sort, and perform quick searches.
  • Use shortcode flexibly to display limited data.
  • Display custom field content as table columns.

So, what are you waiting for? Start creating custom post types with the Easy Post Types and Fields plugin and display them with Posts Table Pro on your website. If you have any questions about our custom post type WordPress tutorial, let us know in the comments section below!!

2 Comments

    • Hi, Pawel. Thanks for your comment. For a custom post type, you can add/create categories as custom taxonomies (which you can see mentioned in this article). I hope this helps. Please let me know if you have any more questions. You can also get in touch via our dedicated Support Center. For quick reference, you can browse our detailed and extensive plugin Knowledge Base articles and tutorials. Cheers.

Please share your thoughts...

Your email address will not be published. Required fields are marked *