How to Hide the LiteSpeed Cache Admin Menus and Meta Box

LiteSpeed Cache is an amazing plugin, mainly because it gives you an easy and centralized way to manage your server cache, (some) CDN settings, and optimization features. However, one of the few downsides is that it clutters up the WordPress dashboard with too many screens and options that not everyone wants to see or use. Nowadays, you get by default:

  • A “LiteSpeed Cache” submenu under the Settings menu.
  • A “LiteSpeed Cache” top-level menu with submenus within it.
  • The “LiteSpeed Options” meta box on every page and post.

Want to hide them to make your WordPress backend a little tidier? No problem. Keep in mind that this will not speed up your WordPress backend because the same number of SQL queries will be performed. This is just a purely cosmetic change that you can use to tidy up the WordPress control panel.

Hide the LiteSpeed Cache Admin Menus

Open your functions.php and insert the following code at the end. This code is customizable and self-explanatory: Each line that starts with a // is a comment that refers to the next line. So if you want to keep a certain menu, simply remove the corresponding line from the code snippet.

Notice that if you remove a menu, it will no longer be accessible, even if you call up the URL manually.

    function acc_hide_litespeed_cache_menus() {
    	//Hide "Settings → LiteSpeed Cache"
    	remove_submenu_page('options-general.php', 'litespeed-cache-options');
    
    	//Hide "LiteSpeed Cache" top-level menu
    	remove_menu_page('litespeed');
    
    	//Hide "LiteSpeed Cache → Dashboard"
    	remove_submenu_page('litespeed', 'litespeed');
    	//Hide "LiteSpeed Cache → Presets"
    	remove_submenu_page('litespeed', 'litespeed-presets');
    	//Hide "LiteSpeed Cache → General"
    	remove_submenu_page('litespeed', 'litespeed-general');
    	//Hide "LiteSpeed Cache → Cache"
    	remove_submenu_page('litespeed', 'litespeed-cache');
    	//Hide "LiteSpeed Cache → CDN"
    	remove_submenu_page('litespeed', 'litespeed-cdn');
    	//Hide "LiteSpeed Cache → Image Optimization"
    	remove_submenu_page('litespeed', 'litespeed-img_optm');
    	//Hide "LiteSpeed Cache → Page Optimization"
    	remove_submenu_page('litespeed', 'litespeed-page_optm');
    	//Hide "LiteSpeed Cache → Database"
    	remove_submenu_page('litespeed', 'litespeed-db_optm');
    	//Hide "LiteSpeed Cache → Crawler"
    	remove_submenu_page('litespeed', 'litespeed-crawler');
    	//Hide "LiteSpeed Cache → Toolbox"
    	remove_submenu_page('litespeed', 'litespeed-toolbox');
    }
    add_action('admin_menu', 'acc_hide_litespeed_cache_menus', 11);

    Hide the LiteSpeed Cache Meta Box

    Add the following to the functions.php file too:

    // Hide the "LiteSpeed Options" meta box.
    function acc_hide_litespeed_cache_metaboxes() {
    	$screen = get_current_screen();
    	if ( !$screen ) {
    		return;
    	}
    	remove_meta_box('litespeed_meta_boxes', $screen->id, 'side');
    }
    add_action('add_meta_boxes', 'acc_hide_litespeed_cache_metaboxes', 20);

    Notice that although the meta box will be removed, it will still be executed. So if you already had custom settings for a specific page, they will still work.

    Newsletter Updates

    Enter your email address below and subscribe to our newsletter

    Leave a Reply

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