Fatal error with litespeed cache

[ad_1]

I am getting the occasional fatal error using litespeed cache and this plugin.

It looks like liespped calls pre_kses very early and the sanitize_attributes function which is hooked to that action filter then causes the following fatal error: PHP Fatal error: Uncaught Error: Undefined constant “SECURE_AUTH_COOKIE”

This can be prevented by amending the function to instead be:


/**
* Strips
attributesForBlocks block attribute when the current user doesn't have unfiltered_html capabilities.
*
* @param string $content Content to filter through KSES.
*/
function sanitize_attributes($content) {

if (!defined('SECURE_AUTH_COOKIE')) {

require_once(ABSPATH . WPINC . '/default-constants.php');

}

if(!function_exists('wp_get_current_user')) {

require ABSPATH . WPINC . '/pluggable.php';
}

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer