wordpress custom post type disable add new

To disable the "Add New" functionality for a custom post type in WordPress, you can follow these steps:

  1. Open your theme's functions.php file. This file is typically located in your theme's directory.

  2. Inside the functions.php file, add the following code snippet:

function disable_custom_post_type_new() {
    global $submenu;
    $post_type = 'your_custom_post_type_slug'; // Replace 'your_custom_post_type_slug' with the actual slug of your custom post type

    // Remove the 'Add New' submenu item
    unset($submenu['edit.php?post_type='.$post_type][10]);
}
add_action('admin_menu', 'disable_custom_post_type_new');
  1. In the code snippet above, make sure to replace 'your_custom_post_type_slug' with the actual slug of your custom post type. This slug is defined when registering the custom post type.

  2. Save the functions.php file.

By following these steps, the "Add New" submenu item for your custom post type will be removed from the WordPress admin menu.