Title: wp-config.php operation failed when changing `WP_CACHE` const
Last modified: January 26, 2024

---

# wp-config.php operation failed when changing `WP_CACHE` const

 *  Resolved [Surbma](https://wordpress.org/support/users/surbma/)
 * (@surbma)
 * [2 years, 4 months ago](https://wordpress.org/support/topic/wp-config-php-operation-failed-when-changing-wp_cache-const/)
 * Hi,
 * my hosting has a lot of security features, one of them is that they do not allow
   to write the wp-config.php file. Your plugin is checking, if wp-config.php is
   writable to define this: `define('WP_CACHE', true);` Hence the admin error notification,
   that says wp-config.php file is not writable.
 * But it should also check if the necessary setting is already defined, so there
   is no need for the admin error notification.
 * Please fix your code to check if `WP_CACHE` is defined and if it is set to true
   and if so, don’t show the error notification!
 * Thank you!

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Support [qtwrk](https://wordpress.org/support/users/qtwrk/)
 * (@qtwrk)
 * [2 years, 4 months ago](https://wordpress.org/support/topic/wp-config-php-operation-failed-when-changing-wp_cache-const/#post-17380423)
 * thanks for the info , I will forward this to our devs
 * ——
 * so I just looked at the code , it’s weird, because it does have the check arelady
 *     ```wp-block-code
       		if ($enable) {
       			if (defined('WP_CACHE') && WP_CACHE) {
       				return false;
       			}
       ```
   
 * ref: [https://github.com/litespeedtech/lscache_wp/blob/f40c3d33fde17546467f0e68e206855a1521480e/src/activation.cls.php#L400](https://github.com/litespeedtech/lscache_wp/blob/f40c3d33fde17546467f0e68e206855a1521480e/src/activation.cls.php#L400)
 * could you please check WP_CACHE ?
    -  This reply was modified 2 years, 4 months ago by [qtwrk](https://wordpress.org/support/users/qtwrk/).
 *  Thread Starter [Surbma](https://wordpress.org/support/users/surbma/)
 * (@surbma)
 * [2 years, 4 months ago](https://wordpress.org/support/topic/wp-config-php-operation-failed-when-changing-wp_cache-const/#post-17380564)
 * Your code is checking, if $enable is set to true. If it is not true, then the
   condition in the 403. line returns false, because the WP_CACHE is defined and
   it is set to true. Therefore the first two conditions are ignored and the process
   is running till it finds out, that the file is not writable.
 * You need to change the condition logic in this function so it will return false,
   when WP_CACHE is defined and it is set to true. 😉
    -  This reply was modified 2 years, 4 months ago by [Surbma](https://wordpress.org/support/users/surbma/).
 *  [flberger](https://wordpress.org/support/users/flberger/)
 * (@flberger)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/wp-config-php-operation-failed-when-changing-wp_cache-const/#post-17503429)
 * The error is still present in my setup with LS Cache 6.1 on my setup. The suggestion
   by [@surbma](https://wordpress.org/support/users/surbma/) would solve this. A
   fixed and updated version would be appreciated.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘wp-config.php operation failed when changing `WP_CACHE` const’ is closed
to new replies.

 * ![](https://ps.w.org/litespeed-cache/assets/icon-256x256.png?rev=2554181)
 * [LiteSpeed Cache](https://wordpress.org/plugins/litespeed-cache/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/litespeed-cache/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/litespeed-cache/)
 * [Active Topics](https://wordpress.org/support/plugin/litespeed-cache/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/litespeed-cache/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/litespeed-cache/reviews/)

 * 3 replies
 * 3 participants
 * Last reply from: [flberger](https://wordpress.org/support/users/flberger/)
 * Last activity: [2 years, 2 months ago](https://wordpress.org/support/topic/wp-config-php-operation-failed-when-changing-wp_cache-const/#post-17503429)
 * Status: resolved