Remove Add, Edit, Delete Posts Option from Custom Post Type

In this article, we will take a look into removing the Add New post button and removing the Edit and Delete posts options from the custom post type.

You can remove add new post button, and edit and delete posts link from the custom post type by just limiting the capabilities of your custom post type.

To do that, you have to pass ‘capabilities’ and ‘map_meta_cap’ parameters inside the array of arguments of your custom post type as highlighted in the below code.

The capabilities parameter contains an array of different capabilities for your custom post type:

  • create_posts: if set false, it will disable the Add New post option.
  • edit_published_posts: if set false, it will disables the edit post option.
  • delete_published_posts: if set false, it will disables the trash post option.

You can find more custom post type capabilities at WordPress developer resources

 $args = array(
        'label'               => __( 'Your Custom Post Type', 'twentytwenty' ),
        'description'         => __( 'Your Custom Post Type', 'twentytwenty' ),
        'labels'              => $labels,
        'supports'            => array( 'title', 'editor', 'excerpt', 'author'),
        'hierarchical'        => false,
        'public'              => true,
        'show_ui'             => true,
        'show_in_menu'        => true,
        'show_in_nav_menus'   => true,
        'show_in_admin_bar'   => true,
        'can_export'          => true,
        'has_archive'         => true,
        'exclude_from_search' => false,
        'publicly_queryable'  => true,
        'capability_type'     => 'post',
        'show_in_rest' => true,
        'capabilities' => array(
            'create_posts' => false,
            'edit_published_posts' => false,
            'delete_published_posts' => false,
        'map_meta_cap' => true,
    // Registering your Custom Post Type
    register_post_type( 'your-custom-post-type', $args );
Owner of, solely responsible for creating helpful, informative content about WordPress, a fulltime WordPress developer with 8+ years of hands-on experience in WordPress design and development.