Skip to content

Fix LiteSpeed Cache Plugin Not Saving Settings

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.

  1. Start by backing up your site’s database just in case you need to restore it.
  2. Deactivate the LiteSpeed cache plugin.
  3. 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’s wp-config.php is located.
  4. 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";
  1. Once done, go to the following URL: https://www.example.com/repair.php, where example.com is your domain. You should get the response “done“.
  2. 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.
Share:

Leave a Reply

Feel free to share your comments or questions with me. I may not be able to respond immediately so please check later once I've approved your comment.

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

Kelvin Kathia

Kelvin Kathia is a writer that's passionate about sharing solutions to everyday tech problems. He's the founder and editor of Journey Bytes, a tech blog and web design agency. Feel free to leave him comments or questions regarding this post, or by leaving him a message on the contact page. If you found his content helpful, a donation is much appreciated.