WP-Mix

A fresh mix of code snippets and tutorials

WordPress Remove Screen Options

Normally the “Screen Options” tab is an awesome little WordPress feature. Located on various screens in the WP Admin Area, the Screen Options tab toggles open any available settings. Like which meta boxes to display, layout columns, editor auto-height, and other options depending on which screen you are viewing.

But there may be cases where you want to hide the Screen Options. Maybe just for certain user roles or specific admin screens, or maybe you want to disable Screen Options completely for all users. Whatever the case, here is a function that can help make it happen.

function shapeSpace_remove_screen_options() {
	
	global $current_user;
	
	if (!current_user_can('administrator')) {
		
		return false;
		
	} else {
		
		return true;
		
	}
	
}
add_filter('screen_options_show_screen', 'shapeSpace_remove_screen_options');

As written, this function:

  1. Grabs the $current_user global variable
  2. Checks if the current user is an administrator
  3. If not, then returns false to hide Screen Options
  4. Otherwise, returns true to show Screen Options for admin users
  5. Lastly the function is hooked into the filter, screen_options_show_screen

So by tweaking the conditional logic used by this function, you can show/hide the Screen Options to any user(s), roles, or whatever else is required.

Learn more

Digging Into WordPressWordPress Themes In DepthWizard’s SQL Recipes for WordPress