How To Hide Screen Options in WordPress

Screen Options Hide

We received an interesting question this week from a PublishPress user. One of our customers wanted to remove elements from the “Screen Options” dropdown panel in WordPress.

The “Screen Options” tab is available in most areas of the WordPress admin area. This image below shows an example from the “Pages” screen.

Screen Shot 2022 08 16 At 5.13.21 Pm
Screen Shot 2022 08 16 At 5.13.21 Pm

In this article, we will explain how to hide elements in Screen Options, both for yourself and for all the users on your site.

Please note that this will not actually hide anything on the main screen. In this article, we're only showing you how to remove choices from inside the Screen Options dropdown.


Option #1. Hide Screen Options from Yourself

If you want to hide elements from yourself, you can simply uncheck the box. In this screenshot below, I've unchecked the “WooCommerce Setup” box.

Hide Screen Options 1
Hide Screen Options 1

Once I do this, I will no longer see the “WooCommerce Setup” box on my WordPress dashboard. You can see the metabox in the image below. Click here for a more complete guide to hiding dashboard widgets.

Woocommerce Setup
Woocommerce Setup

Option #2. Hide Screen Options for Everyone

This second option is more difficult to implement, but will hide a Screen Option element for all your site's users.

First, decide on the element you want to hide. For example, I want to hide the “Permissions: Read this Post” element that you can see in this image below:

To hide this element, we need to find the selector for this part of the WordPress admin area. You can do that by going to the Developer Tools feature in Chrome. Most other browsers have a very similar feature. From the screenshot, you can see that I have found this selector: pp_read_post_exceptions-hide.

Image2
Image2

Now add the code below to your theme's function.php file:

add_action('admin_head', 'hide_custom_elements');

function hide_custom_elements() {
  echo '<style>
    #screen-options-wrap label[for="pp_read_post_exceptions-hide"] {
    display: none;
}
  </style>';
}

After you insert that code, you will not see the element in Screen Options. This next screenshot shows how the area appears after we applied the code:


Leave a Reply

Your email address will not be published. Required fields are marked *

Professional publishing plugins for WordPress! Get PublishPress