The LiteSpeed Cache plugin is an all-in-one WordPress optimization solution for sites running on the LiteSpeed Server. It includes server-level cache, page and image optimization tools amongst other site-acceleration tools.
I personally use the plugin on this site and confirm it does indeed improve the site’s speed when configured properly. You may however run into a peculiar problem with the plugin as I did recently when it stopped saving any settings.
As far as I can tell, this happened without me making any changes whatsoever to the site. Uninstalling and reinstalling the plugin also does not fix the problem.
This behavior indicates the plugin’s database might be corrupted or damaged, and the only way to fix such an issue is to reset its database. I did exactly this and the plugin stated working normally again. Here’s what you need to do.
How to Reset LiteSpeed Cache Plugin’s Database
Note: Doing this will reset the plugin to its initial state, hence you’ll lose all the current settings you have configured. You may therefore want to first export all your current settings by going to LiteSpeed Cache > Toolbox > Import / Export. You can thereafter restore the settings once the database has been reset as follows.
- Start by backing up your site’s database just in case you need to restore it.
- Deactivate the LiteSpeed cache plugin.
- Log into your server’s file manager or over FTP and create a PHP file named
repair.php
in the same directory where your site’swp-config.php
is located. - Save the following code in the repair.php file:
<?php
define( 'WP_USE_THEMES', false );
require( './wp-load.php' );
global $wpdb;
$table_name = $wpdb->prefix . 'options';
$table_name = "{$wpdb->prefix}options";
$wpdb->query( $wpdb->prepare( "DELETE FROM `$table_name` WHERE `option_name` like '%litespeed.%' " ) );
if ( defined( 'LSCWP_V' ) ) {
do_action( 'litespeed_purge_all' );
}
echo "done";
- Once done, go to the following URL:
https://www.example.com/repair.php
, whereexample.com
is your domain. You should get the response “done“. - Delete the
repair.php
file, then go back into WordPress and reactivate the LiteSpeed Cache plugin. The plugin should now be able to keep settings.