Admin & Dashboard PHP Beginner

Hide Screen Options From Non-Administrators

Remove the Screen Options tab for editors and other roles, so they can't hide important columns and boxes by accident.

Tested on WordPress 7.1 PHP 8.3 No plugin needed Updated
functions.php 3 lines
add_filter( 'screen_options_show_screen', function (): bool {
	return current_user_can( 'manage_options' );
} );

Where to add this

Recommended A code snippets plugin Survives theme changes and is easy to switch off.
Child theme At the end of your child theme's functions.php file.
Must-use plugin As a .php file in wp-content/mu-plugins, starting with <?php.

Always add PHP to a staging site first, or have FTP or file manager access ready, so you can undo it if something goes wrong.

Screen Options lets each user hide columns and meta boxes. Clients sometimes untick something by accident and then can’t find it. This snippet keeps the tab for administrators only.

How it works

WordPress asks screen_options_show_screen whether to show the Screen Options tab on each screen. Returning whether the user can manage options hides it for everyone else.

Things to watch

  • Choices users already made stay in place. If someone already hid a box, ask an administrator to reset it, or delete that user’s metaboxhidden_ user meta.
  • Pagination settings, such as items per page, are also in Screen Options. Set sensible defaults with the snippet that changes posts per page in admin lists.

How to test it

Log in as an editor and open Posts. There should be no Screen Options tab.

This website uses cookies to enhance your browsing experience and ensure the site functions properly. By continuing to use this site, you acknowledge and accept our use of cookies.

Accept All Accept Required Only