The Complete Guide To WordPress Custom Post Types

WordPress is not always about “Posts” and “Pages”. Sometimes you need to have different content types because not every WordPress site is about blogs. You need the ability to add Custom Post Types to your WordPress site.

If you have the ability to use post types then you can turn your admin area into an organized, exciting, and beautiful place. Ultimately, you want your WordPress site to feel empowering when creating new content.

Custom post types let you turn your blogging site into a more powerful Content Management System. As you can create other content types than just posts and pages.

So, today we are going to address this unique ability of WordPress and guide on creating a custom post of your own for your site.

But first let's get into the basics, shall we?

What is Custom Post Type in WordPress?

The Complete Guide To WordPress Custom Post Types 02

Post types are ways of categorizing different types of content in WordPress.

We are assuming you’re already familiar with the two most common post types: posts and pages. But what you might not know that WordPress comes bundled with a few other post types as well.

By default, WordPress comes with these post types:

  • Post
  • Page
  • Attachment
  • Revision
  • Nav Menu.

Therefore you can create your own custom post types and call them whatever you want.

For instance, if you run a book review website, then you would probably want to create a book reviews post type. This post type can have different custom fields and even its own custom category structure.

Other examples of post types are Movies, Portfolio, Testimonials, Products, etc.

So, if you want to create your own portfolio, we suggest you take the help of custom post types. Otherwise, you can easily get lost. Creating a separate portfolio post type will allow your users to easily browse through all of your work.

Now, we are going to show you the method of creating WordPress custom post types. There are 2 types of method:

  1. Creating Custom Post Types (Using a Plugin)
  2. Creating Custom Post Types (Manually)

We are going to show you both ways.

How to Add a Custom Post Type with a WordPress Plugin

Well, this is the part where you will learn how to create a custom post type using a plugin. WordPress has over 65k+ plugins in it's repo. And there are many plugins that will help you create custom post type for your website with ease.

One of them is WP User Frontend. It is one of the best-selling membership plugins around and it makes it super easy to create a custom post type.

After installing the plugin, you need to follow these simple steps to create a custom post type. Here we go,

Step 1: Creating a form 

how to add form in WPUF

No go through WP User Frontend > Post Forms > Add New. Create your form. Add the necessary form fields. Save the form.

Step 2: Setting Post Status

After creating a form you have to navigate through WP User Frontend > Post Forms. Update the existing form by selecting Settings > Post Settings > Post Status.

Therefore, you will be able to see the various custom post types there. Select your post type and save the form.

Step 3: Creating Taxonomy 

creating taxonomy

Next, you have to go back to Form Editor, then under the taxonomy section, you can see custom taxonomy.

Step 4: Create the Page

create page

However, to create a new page copy the shortcode of your form, or edit an existing one. Paste the shortcode.

View the page in the browser. Your custom post type submission is complete.

If you want to watch it live, here is a short video for you. Go through it and make your Custom Post Type form within a few moments.

That is how you can easily create WordPress custom post types using the WordPress User Frontend plugin.


How to Create a Custom Post Type Manually

You must be thinking about why we are showing you to create a custom post type manually when you can create one using a WordPress plugin. Well, the problem with creating a WordPress custom post type with plugins is when you deactivate that plugin, you may lose all your data.

The data may be there in the plugin, but your post type will become unregistered and you will not be able to access it from your admin area.

Therefore, it is a good practice to create a custom post manually. And we are going to start with that.

Take a look at this code,

// Our custom post type function
function create_posttype() {
    register_post_type( 'movies',
    // CPT Options
            'labels' => array(
                'name' => __( 'Movies' ),
                'singular_name' => __( 'Movie' )
            'public' => true,
            'has_archive' => true,
            'rewrite' => array('slug' => 'movies'),
            'show_in_rest' => true,
// Hooking up our function to theme setup
add_action( 'init', 'create_posttype' );

When you add this code to your themes functions.php file, you will see the Movies section on your WordPress menu area.

Let us tell you the functionality of this code. What this code does is that registers a post type 'movies' with an array of arguments. These arguments are the options of our custom post type.

This array has two parts, the first part is labeled, which itself is an array. The second part contains other arguments like public visibility, has archive, slug, and show_in_rest enables block editor support.

Here is a code that will help you add more options to your WordPress custom post type,

* Creating a function to create our CPT
function custom_post_type() {
// Set UI labels for Custom Post Type
    $labels = array(
        'name'                => _x( 'Movies', 'Post Type General Name', 'twentytwenty' ),
        'singular_name'       => _x( 'Movie', 'Post Type Singular Name', 'twentytwenty' ),
        'menu_name'           => __( 'Movies', 'twentytwenty' ),
        'parent_item_colon'   => __( 'Parent Movie', 'twentytwenty' ),
        'all_items'           => __( 'All Movies', 'twentytwenty' ),
        'view_item'           => __( 'View Movie', 'twentytwenty' ),
        'add_new_item'        => __( 'Add New Movie', 'twentytwenty' ),
        'add_new'             => __( 'Add New', 'twentytwenty' ),
        'edit_item'           => __( 'Edit Movie', 'twentytwenty' ),
        'update_item'         => __( 'Update Movie', 'twentytwenty' ),
        'search_items'        => __( 'Search Movie', 'twentytwenty' ),
        'not_found'           => __( 'Not Found', 'twentytwenty' ),
        'not_found_in_trash'  => __( 'Not found in Trash', 'twentytwenty' ),
// Set other options for Custom Post Type
    $args = array(
        'label'               => __( 'movies', 'twentytwenty' ),
        'description'         => __( 'Movie news and reviews', 'twentytwenty' ),
        'labels'              => $labels,
        // Features this CPT supports in Post Editor
        'supports'            => array( 'title', 'editor', 'excerpt', 'author', 'thumbnail', 'comments', 'revisions', 'custom-fields', ),
        // You can associate this CPT with a taxonomy or custom taxonomy. 
        'taxonomies'          => array( 'genres' ),
        /* A hierarchical CPT is like Pages and can have
        * Parent and child items. A non-hierarchical CPT
        * is like Posts.
        'hierarchical'        => false,
        'public'              => true,
        'show_ui'             => true,
        'show_in_menu'        => true,
        'show_in_nav_menus'   => true,
        'show_in_admin_bar'   => true,
        'menu_position'       => 5,
        'can_export'          => true,
        'has_archive'         => true,
        'exclude_from_search' => false,
        'publicly_queryable'  => true,
        'capability_type'     => 'post',
        'show_in_rest' => true,
    // Registering your Custom Post Type
    register_post_type( 'movies', $args );
/* Hook into the 'init' action so that the function
* Containing our post type registration is not 
* unnecessarily executed. 
add_action( 'init', 'custom_post_type', 0 );

As you can see, we have added many more options to the custom post type with this code. Now your post type will have more features like support for revisions, featured image, custom fields, and more.

We have also associated this custom post type with a custom taxonomy called genres.

WordPress Custom Post Types

Bonus Tips for Creating a Custom Post Type Manually

You may also notice that there is a part where we have set the hierarchical value to be false. But if you would like your custom post type to behave like Pages, then you can set this value to true.

Another thing to be noticed is the repeated usage of twentytwenty string, this is called text-domain. So, if your theme is translation ready, then you will need to mention the text domain used by your theme.

You can find your theme’s text domain inside style.css file in your theme directory. The text domain will be mentioned in the header of the file.

Now that you have learned how to create a custom post type on your WordPress site, you need to see how to display the post on your site.

Displaying Custom Post Types on Your Site

To display the newly created custom post type, you need to follow the simple steps.

Just go to Appearance » Menus and add a custom link to your menu. This custom link is the link to your custom post type.


You need to write your custom post type URL like below,

or If you are using SEO friendly permalinks then your CPT’s URL will most likely be something like this:

Don’t forget to replace with your own domain name and movies with your custom post type name.

After you have saved your menu, you can visit your website and you will see the new menu you added, and when you click on it, it will display your custom post type archive page using the archive.php template file in your theme.

Displaying Custom Post Types in Front Page

The main advantage of using WordPress custom post types is that it keeps your custom content away from regular posts. However, if you want you can publish your custom content on the front page.

All you have to do is add this piece of code,

add_action( 'pre_get_posts', 'add_my_post_types_to_query' );
function add_my_post_types_to_query( $query ) {
    if ( is_home() && $query->is_main_query() )
        $query->set( 'post_type', array( 'post', 'movies' ) );
    return $query;

Just replace “movies” with your custom post. That's it!.

So, this is how you can create and display custom post types manually on your WordPress site.

Create Custom Posts & Turn Your Blogging Site to the Perfect CMS Platform

As you can see creating the perfect CMS system is pretty easy with WordPress. Because it gives you the freedom, functionalities, and features to create a customized admin system.

And since creating WordPress custom post types is completely in your hand, you have the power to create additional features for your controls. Also, you can create custom admin pages as well. But we will talk about that another day.

So, create your custom post types following this guide and do let us know your experience!

Rabbir Shad
Written by

Rabbir Shad

Shad is a Content Writer with expertise in eCommerce, SEO, WordPress, and Technology. He has a passion for Football. Besides, he likes to spend time reading a quality book or watching any classic film.

Have something to say? Cancel Reply

Your email address will not be published.

Table of Contents