Question

I need to show the Screen Option tab in WordPress for Admins only, and hide that tab for the rest of the users. How can I do that?

I found this: How to Hide the WordPress Screen Options Tab

function remove_screen_options_tab()
{
    return false;
}
add_filter('screen_options_show_screen', 'remove_screen_options_tab');

But it hides it for every user...

Was it helpful?

Solution

Look for functions.php file, inside your theme folder, and add this code:

  function remove_screen_options_tab() {
       return current_user_can( 'manage_options' );
  }
  add_filter('screen_options_show_screen', 'remove_screen_options_tab');

An admin is the only one that can 'manage_options', so that should work.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top