Add below code snippet
function create_custom_post_type() {
register_post_type('custom_type',
array(
'labels' => array(
'name' => __('Custom Type Name'),
'singular_name' => __('Custom Type Name')
),
'public' => true,
'has_archive' => true,
'capability_type' => 'page', // or 'post'
'map_meta_cap' => true,
'capabilities' => array(
'create_posts' => false, // Removes support for the "Add New" button
),
)
);
}
add_action('init', 'create_custom_post_type');
If you want to add more then one comman, do as shown below
function create_custom_post_type() {
register_post_type('custom_type',
array(
'labels' => array(
'name' => __('Custom Type Name'),
'singular_name' => __('Custom Type Name')
),
'public' => true,
'has_archive' => true,
'capability_type' => 'page', // or 'post'
'map_meta_cap' => true,
'capabilities' => array(
'create_posts' => false, // Removes support for the "Add New" button
),
)
);
register_post_type('custom_type',
array(
'labels' => array(
'name' => __('Custom Type Name'),
'singular_name' => __('Custom Type Name')
),
'public' => true,
'has_archive' => true,
'capability_type' => 'page', // or 'post'
'map_meta_cap' => true,
'capabilities' => array(
'create_posts' => false, // Removes support for the "Add New" button
),
)
);
}
add_action('init', 'create_custom_post_type');
Change custom_type to your correct slug.
Change Custom Type Name to your Post Type Name.