Skip to content
Related Articles

Related Articles

Create custom post type in WordPress

View Discussion
Improve Article
Save Article
  • Difficulty Level : Expert
  • Last Updated : 22 Mar, 2022
View Discussion
Improve Article
Save Article

The WordPress software is very handy and flexible to use as it allows not only the use of different posts and webpages but it also allows the use of the customized created post types with different types of users.

The customizable post types in the WordPress software allow the user to normal and regular website that makes use of WordPress to turn it into a completely new type of website which has the capabilities to become a content management website. It can create a lot of new customizable options for the users to outcast their different items on their website. WordPress allows different types of customizable post types like – a blog post, distinct media attachments, posts revision algorithms, and a new navigation menu for the websites. This customizable post type gets saved in the WordPress software for future use purposes.

In this article, we will learn how to create a custom post type in WordPress and it will work.

The functions which are used to create the customized post types include the init function which is created by using the add_action(), whereas while taking the arguments we use the register_post_type().

Types of Custom post types: The different types of customizable posts in WordPress is as follows:

  • Posts
  • Pages
  • Navigation menu of the website
  • Attachments media on websites
  • Customized CSS
  • Revisions
  • Comments
  • Page attributes
  • Labels
  • Public
  • ChangeSets

Customizable posts allow the users to create a new WordPress project on their website with the recently saved version that enhances the overall look and feel of the posts on that website.


/* Start */
function create_post() {
register_post_type( 'item',

  'labels' => array(
   'name' => __( 'item' ),
   'title_name' => __( 'Item' )
  'public' => true,
  'post_archive' => false,
  'rewrite' => array('slug' => 'item'),
add_action( 'init', 'create_post' );
/* Stop */

How to create a Custom Post type: We can create a custom post type for the WordPress software by the following steps:

Write the following code in the terminal window of the admin bar of the WordPress software to run the program. This will initiate the function.php file in the terminal on the execution.

There are basically three types of customized post-type functions for the WordPress software.

  • $args: It is responsible for calculating and processing the slug option in the items located in the navigation menu of the website. It stands for argument variable which is used to denote the arrays. It stores the data like keys and values inside the array to store the custom post types.
  • $labels: It is responsible for identifying that a particular post type item is only limited to the administrator of the WordPress document only. It represents the first array inside the argument variable of the custom posts.
  • $supports: It is responsible for checking that a particular post type in WordPress is compatible with all types of device form factors like a phone and a PC and it contains all the essential features on that website. The supported variable enables the custom posts type in WordPress to have editor-like features.

Steps to create new custom types:

Step 1: Create a new customized post type with WordPress using a PHP program using a Customized post type with the help of its UI.

Step 2: Select all the options for setting the fields and post types using the ACF programs.

Step 3: Choose an example item on which the newly created customized post types will be added and applied to the content on WordPress.

Step 4: Usage of the dynamic content in the customized posts will result in storing and saving these custom posts on the WordPress server. Now, the customized posts are ready to be published to the server.

Create new post type in WordPress

Algorithm for creating Custom Post using Arg, Label, and Support:

The given below program will allow the users to create and customize new options for the post types in the WordPress along with various other options like customizing title, editor, thumbnail, adding new items, search items, and using the arg, label, and support functions in the program for custom post types. Enter the program in the Custom Articles tab bar and then it will show the option for the terminal window, after the given program gets executed it will create a new customized post type according to the user’s needs.

Enter the given program in the terminal window of the Custom articles tab

/* start */
function create_post() {
    $supports = array(

    $labels = array(
        'name' => _x('item', 'plural'),
        'title_name' => _x('item', 'singular'),
        'menu_name' => _x('item', 'admin menu'),
        'name_admin' => _x('item', 'admin bar'),
        'add_new' => _x('Add New', 'add new'),
        'add_new_item' => __('Add New news'),
        'new_item' => __('New item'),
        'edit_item' => __('Edit item'),
        'view_item' => __('View item'),
        'all_items' => __('All item'),
        'search_items' => __('Search item'),
        'not_found' => __('No item found.'),
    $args = array(
        'supports' => $supports,
        'labels' => $labels,
        'public' => true,
        'query_var' => true,
        'rewrite' => array('slug' => 'item'),

    register_post_type('item', $args);
add_action('init', 'create_post');
/* Stop */
My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!