Register Custom Post In WordPress

Share Now

Share on facebook
Share on pinterest
Share on twitter
Share on linkedin
Share on email

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,
            'show_ui' => true,
            'menu_icon'   => 'dashicons-awards',
        )
    );
}
Nahid Mahamud

Nahid Mahamud

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