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 Post
, Page
, and Product
(for WooCommerce).
This metabox has three switches:
- Disable Cache
- Disable Image Lazyload
- Disable VPI
And it has two textareas:
- Viewport Images
- 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
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:
Please 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.