WordPress Custom Post Type: Everything You Need to Know in 2022

Published at wordpress post management by saelvizhi on 12th Oct 2022

When we install WordPress, the only built-in content types we receive are posts, pages, and media. But WordPress is now quite adaptable and advanced. The method for including more post kinds has also changed. Because posts, pages, and media are insufficient for the variety of usage, more content types are required. This is where WordPress custom post type might be helpful.

Table of Contents:

1. What is Wordpress Custom Post Type?
2. Post Types Included in the WordPress Bundle
3. What is the Difference Between a Post and a Wordpress Custom Post Type?
4. How to Build a WordPress Custom Post Type?
5. WordPress Custom Post Type: Common Uses

1. What is Wordpress Custom Post Type?

In WordPress, post types serve as categorization for different content types. The two most popular post types are posts and pages.  WordPress also has a few other post types.

2. Post Types Included in the WordPress Bundle

There are seven post kinds in WordPress:

  • Pages
  • Posts
  • Attachments
  • Revisions
  • Navigation Menus
  • Custom CSS
  • Changesets

It's likely that you've never heard of change sets and that your website uses custom CSS. But it never occurred to you that these might be post kinds.

The first five post types are posts, pages, attachments, revisions, and navigation menus. These are the only ones that matter to most WordPress users and developers.

Let's examine each of those post types to learn more about them.

WordPress Post Types: Posts

The post type you'll use the most in WordPress is "post." The content in posts is dynamic and intended to be updated frequently. They can have categories and tags added to them. This makes them appear on different archive sites and your home page or blog page. The majority of the information on your site will often be made up of your posts.

Note: There are two meanings for "post" in WordPress. A post in the database can be of any form; therefore, it can contain pages, attachments, and anything else. When most of us talk about posts, we're referring to the postings on our site that fall under the "post" post type.

Types of WordPress Posts: Pages

The other content type you'll be familiar with if you currently have a WordPress website is pages. They provide information on topics that don't change all that frequently and are static content meant to last longer than posts. Examples include your contact information or a company website's "about us" section.

Pages are not intended to be posted on archive pages and cannot have categories or tags. Visitors will instead access them through your navigation menu.

WordPress Post Types: Attachments

A media file that has been uploaded to your site is known as an attachment. This is the information about the media file in the WordPress database, not the media file. As a result, every attachment will have a unique ID and metadata that includes the file's title, description, ALT text, and more.

Attachments can be any upload, including photos, videos, and pdf files. You can either upload them directly to posts or pages when changing them or access and update them using the Media item in the WordPress admin menu. You can then modify and see any attachment you upload to a post via the Media menu.

WordPress Post Types: Revisions

WordPress will create a revision to indicate each time you save a new version of a post, page, attachment, or any custom post type (or page, etc.)

You can see the revisions to any post or page on your site by heading to its editing screen and clicking the Document tab on the right. 

The Revisions box will lead you to a screen with your post's two most recent versions if you click on it. You can read the older versions of the post from this point.

Your site will undergo numerous revisions as a result of WordPress, meaning the database will be stuffed with them. Revisions are a post type like any other and are saved similarly.

WordPress Post Types: Navigation Menus

Navigation menus, or more, the items in your navigation menus, are also a wordpress post type.

Each item in your navigation menu is kept in the database as a separate item. WordPress knows this is a navigation menu item and knows precisely where it belongs in the navigation menu and where it connects to because of its metadata.

The same restrictions apply to editing navigation menu items as they do for other post types. You can alter them instead through the Customizer or the Menus panel.

WordPress Post Types: Custom CSS

This custom post type will be used to save your work if you use the Customizer to add custom CSS. For each theme on your website, a new post (of the "custom CSS" post type) will be created, but WordPress will only use the one for the active theme.

WordPress Post Types: Changesets

Changesets are similar to revisions in that they apply to the Customizer rather than posts. Changes you make using the Customizer are recorded as changesets, which function similarly to draughts.

3. What Is the Difference Between a Post and a Wordpress Custom Post Type?

Let's review: there are two possible outcomes for a post.

A post type is a post (in the broadest sense) to which a specific piece of the material belongs. Additionally, a "post" is a post type, just like a "page," a "attachment," or any other custom post type you register.

Your custom post type, on the other hand, isn't a type of "post" in the sense of a blog post. In the database, all posts are recorded; therefore, it is a type of post in that sense.

4. How to Build a WordPress Custom Post Type:

The Simple Way to Create a Wordpress Custom Post Type Using a Plugin

In WordPress, utilising a plugin is the most straightforward approach to creating a new post type. This method is ideal for beginners because it is both safe and precise.

The first step is to install and activate the Custom Post Type UI plugin. For further information, visit our step-by-step tutorial on How to install a WordPress plugin.

After activation, navigate to CPT UI » Add - Edit Post Types to create a new custom post type. You should be on the tab 'Add New Post Type.'

Add New Post Type

To begin, you must provide a slug for your Wordpress custom post type, such as 'movies.' Only letters and digits are allowed in this slug because it will be used in both the URL and WordPress queries. It would help if you listed the plural and singular names for your custom post type below.

Then, if you'd like, you can select "Populate additional labels based on chosen labels" from the link. You'll typically save time by having this automatically fill up the additional label fields below.

You can now scroll down to that area marked "Additional Labels." You will now need to give a description for your post type and modify labels if you neglect to follow the above option.

Add Edit Post Types

When you are handle material for that specific post type in the WordPress user interface, these labels will be utilised everywhere.

The next step is to configure the post type. From this point, you can configure various post type attributes. There is a summary of what each option does provide with it.

Add Edit Post Types Option

You can decide, for example, not to make a post type hierarchical like pages or to order chronological posts in the opposite order.

Below the general settings, you can decide which editing features this post type will offer. Check the boxes next to the options you want to include.

Add Post Type

Click the "Add Post Type" button to save and create your post type.

Just that. You can add content because you have successfully built your custom post type.

Manually Creating a Wordpress Custom Post Type

The issue with using a plugin is that when the plugin is deactivated, your custom post kinds will vanish. Although your custom post type will be deregistered and inaccessible from the admin area, any data you have in your custom post types will still remain.

If you're working on a client's site and don't want to install another plugin, you can create your post type directly by adding the necessary code to your theme's functions.php file or a site-specific plugin.

We will first give you a brief and complete example to understand how it functions. Look at the following 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' );

This code snippet registers the post type 'movies' with an array of parameters. The options for our custom post type are these arguments.

It consists of two sections. The first section is labelled and contains an array by itself. The second section includes additional options such as public visibility, archive, slug, and show in rest, which enable block editor support.

Let's look at more specific code that gives your Wordpress custom post type more options:


* 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', 'twentytwentyone' ),

        'singular_name'       => _x( 'Movie', 'Post Type Singular Name', 'twentytwentyone' ),

        'menu_name'           => __( 'Movies', 'twentytwentyone' ),

        'parent_item_colon'   => __( 'Parent Movie', 'twentytwentyone' ),

        'all_items'           => __( 'All Movies', 'twentytwentyone' ),

        'view_item'           => __( 'View Movie', 'twentytwentyone' ),

        'add_new_item'        => __( 'Add New Movie', 'twentytwentyone' ),

        'add_new'             => __( 'Add New', 'twentytwentyone' ),

        'edit_item'           => __( 'Edit Movie', 'twentytwentyone' ),

        'update_item'         => __( 'Update Movie', 'twentytwentyone' ),

        'search_items'        => __( 'Search Movie', 'twentytwentyone' ),

        'not_found'           => __( 'Not Found', 'twentytwentyone' ),

        'not_found_in_trash'  => __( 'Not found in Trash', 'twentytwentyone' ),


// Set other options for Custom Post Type

    $args = array(

        'label'               => __( 'movies', 'twentytwentyone' ),

        'description'         => __( 'Movie news and reviews', 'twentytwentyone' ),

        '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, by using this code, we have significantly expanded the custom post type options. It will include new features such as revision support, featured photos, custom fields, and more.

Additionally, we have connected this particular post type to a unique taxonomy named "genres."

You may have also noticed that we set the hierarchical value to false in that section. Set this value to true if you want your custom post type to function similarly to Pages. 

Another thing to note is the twentytwentyone string being used repeatedly; this is known as the "text domain." You must specify the text domain used by your theme if it is translation-ready and you want your custom post types to be translated.

The style.css file in your theme directory contains the text domain for your theme. The file header will make a note of the text domain.

5. WordPress Custom Post Type: Common Uses

The definition of a custom post type is now clear. However, when would you need to employ one? When you want to add content to your website that doesn't fit into one of the pre-built post categories, that's when.

Typical instances of custom post types include:

  • Products for an online store
  • Projects or portfolio pieces for a portfolio website
  • A mapping website's maps
  • Events for a booking site

Wordpress Custom post type are helpful features. They give WordPress the essential flexibility you need to build a custom website. Also, transform it from a vital blogging tool to a content management system.

If you're already using WordPress or are still deciding on a platform, we have the right choice. WPBlazer is a plugin that can help you save time and effort regarding WordPress management.

This management tool can help you with everything from the first WordPress installation to backing up your entire site.