Hey @richtwebguy,
I’ve asked our development for some help on how to accomplish this, when someone has a chance we’ll pass along an update.
Hi @richtwebguy,
Super Cache needs to know where its files are before all of WordPress has finished initialising so that it can serve cached content as quickly as possible.
If it suits your development environment, you can setup wp-config.php
to supply different values to WPCACHEHOME
based on environment or server variables (e.g.: $_SERVER
).
If you do so, please also set up a filter to tell Super Cache not to override your wp-config.php
settings with this code:
add_filter( 'wpsc_enable_wp_config_edit', '__return_false' );
Thanks for the info.
wpsc_enable_wp_config_edit will be a big help. I guess that would go in functions.php?
Question: maybe there are edge cases where this doesn’t work, but is there a reason that defining WPCACHEHOME
as relative to document-root wouldn’t work?
Or instead of
define( 'WPCACHEHOME', '/tweb/websites/texample.com/www/wp-content/plugins/wp-super-cache/' );
using this
define( 'WPCACHEHOME', __DIR__ . '/wp-content/plugins/wp-super-cache/' );
Hi again @richtwebguy,
wpsc_enable_wp_config_edit will be a big help. I guess that would go in functions.php?
Yes, functions.php
would be a fine place to put that.
Question: maybe there are edge cases where this doesn’t work, but is there a reason that defining WPCACHEHOME
as relative to document-root wouldn’t work?
Using ABSPATH
when defining WPCACHEHOME
should be fine – just be sure to do it below where ABSPATH
is defined in wp-config.php
(typically near the bottom).