Removing Litespeed Caching Plugin Warning About Other Plugins

Sep 1, 2022 5:56 PM

So Litespeed has started producing an admin_notice when you have a plugin that might cause issues with the Litespeed Cache Plugin.


Looking at litespeed-cache/thirdparty/litespeed-check.cls.php there are two actions

  * Check for incompatible plugins when any plugin is (de)activated.
 add_action( 'activated_plugin', __CLASS__ . '::activated_plugin', 10, 2 );
 add_action( 'deactivated_plugin', __CLASS__ . '::deactivated_plugin', 10, 2 );

Trying to remove_action these are difficult due to the fact they’re in a namespace and class.

namespace LiteSpeed\Thirdparty;

defined( 'WPINC' ) || exit;

class LiteSpeed_Check {

	public static function detect() {

I found the following articles helpful but couldn’t remove the add_actions.

The issue was due to the fact that I was removing the action before it even existed! On line 191 and 192 of src/core.cls.php you can see that load_thirdparty is loaded during “wp_loaded”

// Load 3rd party hooks
add_action( 'wp_loaded', array( $this, 'load_thirdparty' ), 2 );

So we can remove this action using the following code in a mu-plugin or regular plugin.

add_action('wp_loaded', function () {
    remove_filter('activated_plugin', LiteSpeed\Thirdparty\LiteSpeed_Check::class.'::activated_plugin',10);