Tutorial: create a new custom post type in WordPress

Hi guys! In this tutorial I want to speak about Wordpress. As you might know, Wordpress enables users to create custom post types. You can create a custom post types for Tutorials, Videos, Images, Products, Portfolios, etc.

If you want to create a new post type in Wordpress, open your functions.php file and add this code:

add_action('init', 'new_post_type');
function new_post_type() {
'tutorials', // this is the name of my new custom post type
'labels' => array(
'name' => 'Tutorials',
'singular_name' => 'Tutorials'
'public' => true,
'has_archive' => true,
'rewrite' => array('slug' => 'tutorial_item'),
'supports' => array('title', 'editor', 'thumbnail'),
'can_export' => true,
'show_in_nav_menus' => true,

register_taxonomy('tutorial_category', 'tutorial', array('hierarchical' => true, 'label' => 'Tutorial Categories', 'query_var' => true, 'rewrite' => true));

In this way you can create a new custom type in your Wordpress website!

Leave a Comment