Support » Plugin: Yoast SEO » [Plugin: WordPress SEO by Yoast] Remove Dashboard Menu for some users

  • Hi.
    I want to remove the “SEO”-menu from the dashboard for some users.
    So I tried the following code in the functions.php wich worked well for other menuitems: remove_menu_page(‘wpseo_dashboard’);
    I also tried: remove_menu_page(‘admin.php?page=wpseo_dashboard’);
    Both won’t work… but I don’t know why. 🙁
    When I took a look in the $menu I found:
    [104] => Array
    [0] => SEO
    [1] => manage_options
    [2] => wpseo_dashboard
    [3] => WordPress SEO Configuration
    [4] => menu-top toplevel_page_wpseo_dashboard menu-top-last
    [5] => toplevel_page_wpseo_dashboard
    [6] => )
    So, there I can see the “wpseo_dashboard”!

    Can someone help here? Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • I too am looking for a solution to this issue.

    Will post my findings…

    WordPress 3.4.2
    Wordpress SEO

    To restrict dashboard menu items per user, I insert code (like shown below) into my functions.php file. All of the other restrictions are working. However, I still cannot find what term grabs the WordPress SEO plugin ‘SEO’ sidebar menu item.

    I need to provide my client with a restricted admin access, but I prefer not to have the client playing around with the SEO settings.


    function remove_menus()
    global $menu;
    global $current_user;
    if($current_user->user_login == ‘username’)
    $restricted = array( __(‘Links’), __(‘Pages’), __(‘Dashboard’), __(‘Contact’), __(‘Appearance’), __(‘Plugins’),__(‘Users’), __(‘Tools’), __(‘Performance’) );

    end ($menu);
    while (prev($menu)){
    $value = explode(‘ ‘,$menu[key($menu)][0]);
    if(in_array($value[0] != NULL?$value[0]:”” , $restricted)){unset($menu[key($menu)]);}
    }// end while
    }// end if

    add_action(‘admin_menu’, ‘remove_menus’);


    I’ve tried restricting the following with no luck:

    If anyone has solved this issue please feel free to chime in.
    For now, until I find a solution, I will have to disable the plugin.

    After disabling the plugin, the WP Dashboard then FORCED the next active plugin’s menu item to display.

    Let me further explain…
    In my case the WP-DBManager plugin’s menu was FORCED to be displayed.
    I was able to previously disable this menu with the line __(‘Database’)
    However, disabling the WordPress SEO plugin has forced the Database menu to display even with that line of code active in my functions.php

    What this means is the failure to disable the WordPress SEO menu from the dashboard may not solely be a name/label issue…

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Plugin: WordPress SEO by Yoast] Remove Dashboard Menu for some users’ is closed to new replies.