Plugin activation writes line to wp-config.php




Wordpress LScache Plugin: Plugin activation writes line to wp-config.php

Last Updated on: Wed, 15 Apr 2026 00:00:02
When you activate the litespeed-cache plugin, it writes define(WP_CACHE, true) to the wp-config.php file. In our set up we use environment variables where we define cache. We have a Bedrock setup also ? is there a way to stop the plugin writing this line into this file? If not, then I would recommend adjusting the logic for this so that it checks if that constant is defined already and only if it isnt should it write the line in. That way we can still handle turning the cache on or off via our deployment system. Yes in activation process if it detects WP_CACHE const defined, will not operate the wp-config.php file per https://github.com/litespeedtech/lscache_wp/blob/master/src/activation.cls.php#L319 This code checks if the constant is defined and is true. What I am saying, is that locally or in dev, we would not want to have the caching enabled. But because we use environment variables, WP_CACHE will exist, but will be set to false. So your check allows the writing of that line and then we end up with a fatal error. Because its already defined, but false. The check should just be: if (defined(WP_CACHE))



LiteCache Rush: Speed comes from using less, not from doing it faster



Reference