• Resolved HuntersServices

    (@huntersservices)


    The “Admin View As” plugin shows that my job candidate roles can see the “WP Meta SEO: Quick SEO Preview” dashboard widget. How can I hide this from everyone but Admin? I’d be happy to add code to my functions.php file if needed. Thanks!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author JoomUnited

    (@joomunited)

    Hi,

    I guess this kind of plugin would do the trick 😉 https://fr.wordpress.org/plugins/adminimize/

    Cheers,

    Thread Starter HuntersServices

    (@huntersservices)

    Hmm, I hate to install such a weighty plugin for just one little tweak. I already have User Role Editor installed – if you can you tell me the capability that allows WP SEO to be seen on the dashboard, I can remove it from the job candidate role. Thanks!

    Plugin Author JoomUnited

    (@joomunited)

    Hmm, I hate to install such a weighty plugin

    Yes got that, I’ll check if we can provide some custom stuff to do that.

    Plugin Author JoomUnited

    (@joomunited)

    OK so here it is, you can add the following code to your function.php file to make your widget visible only to admin:

    global $current_user;
    if(!empty($current_user)){
    $roles = $current_user->roles;
    $role = array_shift($roles);
    if($role != ‘administrator’){
    add_action(‘wp_dashboard_setup’, ‘remove_dashboard_widgets’);
    }

    }

    function remove_dashboard_widgets() {
    global $wp_meta_boxes;
    unset($wp_meta_boxes[‘dashboard’][‘normal’][‘core’][‘wpms_dashboard_widget’]);
    }

    Let me know! << do not copy that 🙂

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to hide WP Meta SEO Dashboard Widget?’ is closed to new replies.