Support » Fixing WordPress » Remove "Add New" from custom-post-type for Authors

Viewing 5 replies - 1 through 5 (of 5 total)
  • Check the IDs and classes with Firebug or the like, and hide with css:

    function hide_that_stuff() {
        if('YOURPOSTTYPE' == get_post_type())
      echo '<style type="text/css">
        #favorite-actions {display:none;}
        </style>';
    }
    add_action('admin_head', 'hide_that_stuff');
    Thread Starter cw17s0n

    (@cw17s0n)

    Thanks that got me part of the way the there, below is the full code I used.

    function remove_submenus() {
      if(!current_user_can('activate_plugins')) {
        global $submenu;
        unset($submenu['edit.php?post_type=agents'][10]); // Removes 'Add New'.
    }
    }
    add_action('admin_menu', 'remove_submenus');
    
    function hide_that_stuff() {
        if('agents' == get_post_type())
      echo '<style type="text/css">
        #favorite-actions {display:none;}
        .add-new-h2{display:none;}
        .tablenav{display:none;}
        </style>';
    }
    add_action('admin_head', 'hide_that_stuff');

    Does this code go into function.php?

    Thread Starter cw17s0n

    (@cw17s0n)

    Yes, that is where mine is.

    Thanks for sharing!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Remove "Add New" from custom-post-type for Authors’ is closed to new replies.