Fix for code not hiding WordPress admin menu plugins

Viewed 24

I've added the following to my child functions.php and it works great for hiding menu items except for plugins, eg 'admin.php? page=plugin_name'.

**Hide items from admin menu**
function remove_menus(){
  remove_menu_page( 'options-general.php' );            //Settings
  remove_menu_page( 'tools.php' );                       //Tools
  remove_menu_page( 'edit-comments.php' );               //Comments
  remove_menu_page( 'edit.php?post_type=portfolio' ); // Portfolios
  remove_menu_page( 'admin.php?page=tatsu_settings' );
  remove_menu_page( 'admin.php?page=meta-box' );
}
add_action( 'admin_menu', 'remove_menus' );

Does anyone have any clues?

Many thanks.

1 Answers

please try this

function remove_menus(){


    remove_menu_page('plugins.php'); // Plugins

    // 'admin.php? page=plugin_name'.
   // remove_menu_page( 'plugin_parent_menu_name' );

    /* for remove contact form 7 menu */
   remove_menu_page( 'wpcf7' );


}
add_action( 'admin_menu', 'remove_menus' );
Related