I have many custom post types that need the Add [custom post type] feature but I have a custom post type of “About” and I do not need to “Add New” about to the about custom post type. So I want to remove the button on top that says “Add About”
This is what I mean:
Any idea how I can remove that?
Please refer below :
function disable_new_posts() {
// Hide sidebar link
global $submenu;
unset($submenu['edit.php?post_type=CUSTOM_POST_TYPE'][10]);
// Hide link on listing page
if (isset($_GET['post_type']) && $_GET['post_type'] == 'CUSTOM_POST_TYPE') {
echo '<style type="text/css">
#favorite-actions, .add-new-h2, .tablenav { display:none; }
</style>';
}
}
add_action('admin_menu', 'disable_new_posts');