How to remove admin menu pages inserted by plugins?

Question

I’ve got the following code, which cleans up a lot of stuff that is not going to be used within the admin area:

add_action( 'admin_menu', 'my_remove_menu_pages' );

function my_remove_menu_pages() {
  remove_menu_page( 'edit.php' );                   //Posts
  remove_menu_page( 'upload.php' );                 //Media
  remove_menu_page( 'edit-comments.php' );          //Comments
  remove_menu_page( 'themes.php' );                 //Appearance
  remove_menu_page( 'users.php' );                  //Users
  remove_menu_page( 'tools.php' );                  //Tools
  remove_menu_page( 'options-general.php' );        //Settings

};

However, there are two menu items that have been inserted from plugins.

When I hover over each menu item, it says the links are:

/wp-admin/edit.php?post_type=acf
/wp-admin/admin.php?page=wpcf7

Is there a way to hide these menu pages, too?

0
, , , tmyie 10 years 2014-02-26T12:17:02-05:00 0 Answers 69 views 0

Leave an answer

Browse
Browse