How to Remove the Screen Options Tab with screen_options_show_screen Hook in WordPress

Home » Snippets » How to Remove the Screen Options Tab with screen_options_show_screen Hook in WordPress

Created with:



Creator: WPTurbo Team

Customize with WPTurbo AI

Add Snippet To Project

New Project
Add To Existing Project

The WordPress Screen Options tab can be a helpful feature, offering customizable views of your backend dashboard screens. However, there might be instances where you want to simplify your WordPress Dashboard for users by removing unnecessary distractions or elements. One of these potentially unnecessary elements might be the ‘Screen Options’ tab. If you’ve been wondering how you can remove it, you’re in the right place. This article will guide you through the process of removing the ‘Screen Options’ tab with the use of ‘screen_options_show_screen’ hook, thus giving your Dashboard a cleaner look and feel.

					function wpturbo_remove_screen_options_tab() {
    return false;
add_filter('screen_options_show_screen', 'wpturbo_remove_screen_options_tab');

This given code snippet primarily aids in omitting the screen options tab from the WordPress Dashboard. Let’s dissect this code and understand how it accomplishes its task.

The first line declares a new function wpturbo_remove_screen_options_tab(). The purpose of this function is purely to return false. The function does not take in any parameters and it has a single line of code inside, which is return false;. By doing so, we effectively neutralize any operation or action that is supposed to occur.

function wpturbo_remove_screen_options_tab() {
    return false;

Notice the simplicity and directness of this function. It doesn’t need to execute any sophisticated operations, just assert a false state, when invoked.

The subsequent line of code,

add_filter('screen_options_show_screen', 'wpturbo_remove_screen_options_tab');

attaches the previous function, wpturbo_remove_screen_options_tab(), to the WordPress filter hook named screen_options_show_screen.

WordPress core uses the screen_options_show_screen filter hook to control the display of the screen options tab. It expects a boolean value (true/false). If it gets true, the screen options tab is displayed. If false, it is not.

By default, WordPress would return true for this, but here we’re attaching our custom function to this filter hook that will always return false. Therefore, this overrides the default functionality and always hides the screen options tab regardless of other conditions.

This way, by just writing a few lines of code, we are able to omit the screen options tab from the WordPress Dashboard, achieving a cleaner interface in scenarios where the users do not need to access these options.

Register an account to save your snippets or go Pro to get more features.