Support » Plugins » Remove Add new post button from a custom post type

  • Does anyone know how i can remove the add new button on the edit page of a custom post type? I’ve followed various posts on how to achieve this but none seem to work, such as:

    function hide_buttons() {
          global $pagenow;
          if(is_admin()){
            if( !current_user_can('publish_products') && ($current_screen->id == 'products' || $current_screen->id == 'edit-products')){
                echo "<style type=\"text/css\">.add-new-h2{display: none;}</style>";
            }
          }
    
        }
    add_action('admin_head','hide_buttons');

    [Moderator Note: Please post code or markup snippets between backticks or use the code button. Or better still – use the pastebin. As it stands, your code may now have been permanently damaged/corrupted by the forum’s parser.]

  • The topic ‘Remove Add new post button from a custom post type’ is closed to new replies.