Home » Tutorial » Hide LiteSpeed Options Metabox From Non-Admin

Hide LiteSpeed Options Metabox From Non-Admin

LiteSpeed Options Metabox

The LiteSpeed Options metabox was introduced in LSCWP v5.0 as a convenient way to adjust cache and optimization settings on a per-post basis. It appears in the post editor for new and existing posts of any type, including PostPage, and Product (for WooCommerce).

This metabox has three switches:

  1. Disable Cache
  2. Disable Image Lazyload
  3. Disable VPI

And it has two textareas:

  1. Viewport Images
  2. Viewport Images – Mobile

These settings may help a lot of users, but the problem is that this metabox is being displayed to non-administrator users as well.

LiteSpeed Options Metabox for Admin Only

The LiteSpeed Options metabox appearing for non-admins was bothering me. If it bothers you too, hide the new LiteSpeed metabox on the editing screens for non-administrator users using the following solution:

Add this to your theme’s functions.php:

add_filter( 'litespeed_bypass_metabox', 'bypass_metabox_for_non_admin', 10, 2 );
function bypass_metabox_for_non_admin( $bypass, $post_type ) {
    if ( ! current_user_can( 'administrator' ) ) {
        return true;

Let me know if it works or not.

Read more from Tutorial

Written by:

Morshed Alam
A teacher by profession, a traveler by passion and a netizen by choice.

Have you written on ThoughtMight?Write Today

Leave a Comment

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