How to make Custom Post type in wordpress?

Hello, I hope you are doing well

are you looking for How to make a Custom Post type in WordPress?

The custom post type is added using two way
Custom code and Plugin

If you have not familiar with the code don’t worry you can use the following plugin to add a custom post type!

Custom Post Type UI


How to add a custom post-type plugin and manage all the things!

If you are aware of coding follow the below steps to create the custom post type you want!

Firstly go to your active theme or child theme and backup first your functions.php file

Now open the functions.php file and paste below code

/*custom hrtechpro CPT start*/
function hrtechpro_CPT() {
// Set UI labels for Custom Post Type
$wpcpt_labels = array(
'name' => _x( 'hrtechpro', 'Post Type General Name', 'twentytwenty' ),
'singular_name' => _x( 'hrtechpro', 'Post Type Singular Name', 'twentytwenty' ),
'menu_name' => __( 'hrtechpro', 'twentytwenty' ),
'parent_item_colon' => __( 'Parent hrtechpro', 'twentytwenty' ),
'all_items' => __( 'All hrtechpro', 'twentytwenty' ),
'view_item' => __( 'View hrtechpro', 'twentytwenty' ),
'add_new_item' => __( 'Add New hrtechpro', 'twentytwenty' ),
'add_new' => __( 'Add New', 'twentytwenty' ),
'edit_item' => __( 'Edit hrtechpro', 'twentytwenty' ),
'update_item' => __( 'Update hrtechpro', 'twentytwenty' ),
'search_items' => __( 'Search hrtechpro', 'twentytwenty' ),
'not_found' => __( 'Not Found', 'twentytwenty' ),
'not_found_in_trash' => __( 'Not found in Trash', 'twentytwenty' ),
);
$precious_bits = array(
'label' => __( 'hrtechpro', 'twentytwenty' ),
'description' => __( 'hrtechpro news and reviews', 'twentytwenty' ),
'labels' => $wpcpt_labels,
'supports' => array( 'title', 'editor', 'excerpt', 'author', 'thumbnail', 'comments', 'revisions', 'custom-fields', ),
'taxonomies' => array( 'genres','category','post_tag' ), //if you want category, tags
'hierarchical' => true,
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'show_in_nav_menus' => true,
'show_in_admin_bar' => true,
'menu_position' => 5,
'menu_icon' => 'dashicons-awards',
'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( 'hrtechpro', $precious_bits );
}
add_action( 'init', 'hrtechpro_CPT', 0 );
/*custom hrtechpro CPT END*/

Now save the file and refresh the WordPress admin panel, check Custom post type is added or not like the below image

How to make Custom Post type in wordpress

Once will be shown then go to the Settings>>Permalinks

On the permalink, page Click on the Save Changes button to Flush the permalink!

Custom Post type save permalink

If you have found useful information in this article please share with who is needs help.

Sharing is caring.

Discover More

Subscribe
Notify of
0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments