How to Create Custom Post Type in WordPress Without Plugin

Want to create a Custom Post Type (CPT) in WordPress without using any plugin? This easy-to-follow tutorial shows you how to register a CPT using code only, giving you full control over your website structure.

๐ŸŽฏ In this video, you’ll learn:

โœ… What is a custom post type
โœ… When and why to use CPTs in WordPress
โœ… How to register a new post type using functions.php
โœ… How to show the CPT in your WordPress admin
โœ… Tips to customize labels, menu icons, and support features
โœ… How to display CPT content on your theme

๐Ÿ“ Use Case Examples:

  • Portfolio
  • Testimonials
  • Services
  • Events
  • Doctors / Medical Staff

๐Ÿ—ฃ๏ธ Language: Urdu / Hindi
๐Ÿ’ป Skill Level: Beginner to Intermediate
๐Ÿง  Bonus Tip: No plugin = faster site + cleaner backend.

// Tutorial Custom Post Type
function Tutorial_init() {
// set up Tutorial labels
$labels = array(
‘name’ => ‘Tutorials’,
‘singular_name’ => ‘Tutorial’,
‘add_new’ => ‘Add New Tutorial’,
‘add_new_item’ => ‘Add New Tutorial’,
‘edit_item’ => ‘Edit Tutorial’,
‘new_item’ => ‘New Tutorial’,
‘all_items’ => ‘All Tutorials’,
‘view_item’ => ‘View Tutorial’,
‘search_items’ => ‘Search Tutorials’,
‘not_found’ => ‘No Tutorials Found’,
‘not_found_in_trash’ => ‘No Tutorials found in Trash’,
‘parent_item_colon’ => ”,
‘menu_name’ => ‘Tutorials’,
);

// register post type
$args = array(
‘labels’ => $labels,
‘public’ => true,
‘has_archive’ => true,
‘show_ui’ => true,
‘capability_type’ => ‘post’,
‘hierarchical’ => false,
‘rewrite’ => array(‘slug’ => ‘Tutorial’),
‘query_var’ => true,
‘menu_icon’ => ‘dashicons-randomize’,
‘supports’ => array(
‘title’,
‘editor’,
‘excerpt’,
‘trackbacks’,
‘custom-fields’,
‘comments’,
‘revisions’,
‘thumbnail’,
‘author’,
‘page-attributes’
)
);
register_post_type( ‘Tutorial’, $args );

// register taxonomy
register_taxonomy(‘tutorial_category’, ‘tutorial’, array(‘hierarchical’ => true, ‘label’ => ‘Category’, ‘query_var’ => true, ‘rewrite’ => array( ‘slug’ => ‘tutorial-category’ )));
}
add_action( ‘init’, ‘Tutorial_init’ );

Leave a Reply

Your email address will not be published. Required fields are marked *