Register Custom Post In WordPress

Share Now

Add this code in function.php

//registering custom post
add_action( 'init', 'themename_custom_posts' );
function themename_custom_posts() {
    

    //custom post type
    register_post_type( 'name',
        array(
            'labels' => array(
                'name' => __( 'Names' ),
                'singular_name' => __( 'name' )
            ),
            'supports' => array('title', 'editor', 'thumbnail', 'page-attributes'),
            'public' => false,
            'publicly_queryable' => true,
            'show_ui' => true,
            'menu_icon'   => 'dashicons-awards',
        )
    );
}
Nahid Mahamud

Nahid Mahamud

Web Developer | Graphic Designer | WordPress & Woo-commerce Expert