Removing the Screen Options and Help tabs from wp-admin

How to the remove “Screen Options” and “Help” tabs from the wp-admin

Ok so part 2 in my loosely tied together series on “Cleaning up the WordPress admin” is about how to remove the “Screen Options” and “Help” tab from the top right of the screen. In case you missed part 1 – cleaning up the admin footer in my mini series, the reason I’m doing this is to help clean up the admin to give the writers on our site a much cleaner / easier / less distracting writing experience. As usual, add the following to your theme’s functions.php file.

 

Removing the Help Tab

Unsurprisingly it’s pretty easy to do with a filter. You can of course wrap it in a if statement if you want to conditionally remove it.


/**
* Removes the Help tab in the WP Admin
*
* @param array $old_help
* @param int $screen_id
* @param obj $screen
* @return array
*/
function oz_remove_help_tabs( $old_help, $screen_id, $screen ){
	$screen->remove_help_tabs();
	return $old_help;
}
add_filter( 'contextual_help', 'oz_remove_help_tabs', 999, 3 );

Removing the Screen Options Tab

This is actually even easier:

add_filter( 'screen_options_show_screen', '__return_false' );

Of course if you you want to conditionally show it you’ll need to point it to a custom function rather than the WordPress __return_false one. Although simple the only slight snag with this method is that you’ll lose any previously customised screen options, (columns on the admin homepage for example). However an anonymous user in this excellent stackoverflow question provides a solution.

function oz_remove_screen_options( $display_boolean, $wp_screen_object ){
	$blacklist = array('post.php', 'post-new.php', 'index.php', 'edit.php');
	if ( in_array( $GLOBALS['pagenow'], $blacklist ) ) {
		$wp_screen_object->render_screen_layout();
		$wp_screen_object->render_per_page_options();
		return false;
    }
	return true;
}
add_filter( 'screen_options_show_screen', 'oz_remove_screen_options', 10, 2 );

Whilst very similar this will not lose any saved screen options and will only remove the tab for the pages listed in the $blacklist array.

Part 3 is cleaning up the WordPress Dashboard