How to remove the “+Add Category” button from the Category metabox?

Question

I would like to disable the “+Add Category Button” under the Category metabox so that anyone creating a post has to choose only from the list of existing categories.

  1. I did check out another post, which literally has the same question,
    How To Remove The "+ Add New Category" Link From A Category Metabox
    But the accepted answer doesn’t make sense because he references Line 345-367, which are not relevant lines (maybe because of WP updates, things might have changed). So I am confused.

  2. I installed the ‘User Role Editor’ plugin and removed the ‘manage_categories’ capability for the ‘Editor’ which worked. But I would like to remove it for ALL users including admin, superadmin. So I tried changing the theme’s functions.php as:

    add_action( 'add_meta_boxes', 'isa_remove_categories_meta_box' )
    function isa_remove_categories_meta_box() {
    
    remove_meta_box( 'categorydiv', 'post', 'side' );// remove the Categories box
    
    }
    

    But, this makes the entire Category box disappear. Is there anything I can use to replace the ‘categorydiv’ to make only the ‘+Add New Category’ disappear?

Or, can someone point me out to what the accepted answer from the other post meant by lines 345-367? I can try that as well.

0
Ashwin Baskaran 3 months 0 Answers 12 views 0

Leave an answer