Hide widgets/plugins from dashboard

I have two plugins in the dashboard, SEO WordPress and Custom Content Type Manager, and for security reasons I want to hide these from dashboard. How to do that?

I tried to hide the SEO WordPress with this:

Read More
// Remove Admin Dashboard menus
 function wp_admin_dashboard_remove_menus() {
     global $menu;
     $restricted = array(('Comments'), __('Users'), __('Updates'), __('wpseo_dashboard'));
     end ($menu);
     while (prev($menu)){
         $value = explode(' ',$menu[key($menu)][0]);
         if(in_array($value[0] != NULL?$value[0]:"" , $restricted)){
             unset($menu[key($menu)]);
         }
     }
 }

 add_action('admin_menu', 'wp_admin_dashboard_remove_menus');

Tried many combinations like:

__('wpseo')
__('wp-seo')
__('wp_seo')

But the SEO menu did not hide.

Related posts

Leave a Reply

3 comments

  1. WordPress SEO

    If you want to remove the admin menu:

    wpseo

    you can do that with:

    function hide_wpseo() {
           remove_action('admin_menu', 'zeo_options_menu');
    }
    add_action( 'init', 'hide_wpseo');
    

    where it will be removed for all users.

    WordPress SEO by Yoast

    To hide the admin menu:

    admin menu

    and the admin menu bar:

    admin menu bar

    one can use:

    function hide_yoastseo() {
        remove_action('admin_bar_menu', 'wpseo_admin_bar_menu',95);
        remove_menu_page('wpseo_dashboard');
    }
    add_action( 'admin_init', 'hide_yoastseo');
    

    where it will be hidden for all users.

    Custom Content Type Manager

    Here one can hide the admin menu:

    admin menu

    from all users with:

    function hide_cctm() {
        remove_menu_page('cctm');
    }
    add_action('admin_init', 'hide_cctm');
    
  2. For removing plugin’s menu from multisite dashboard

    foreach($GLOBALS[ 'menu' ] as $key => $value) {
    
        remove_menu_page($value[2]);
    
    }
    

    For adding menu use add_menu_page();