Morning Douglas;
As per the FAQ you can change where AO writes the cache:
Can I change the directory & filename of cached autoptimize files?
Yes, if you want to serve files from e.g. /wp-content/resources/aggregated_12345.css instead of the default /wp-content/cache/autoptimize/autoptimize_12345.css, then add this to wp-config.php:
define('AUTOPTIMIZE_CACHE_CHILD_DIR','/resources/');
define('AUTOPTIMIZE_CACHEFILE_PREFIX','aggregated_');
hope this helps,
frank
@futtta
I attempted to change the directory per the wp-config.php as you mentioned but it didn’t do anything:
define('AUTOPTIMIZE_CACHE_CHILD_DIR', ABSPATH.UPLOADS.'/cache/autoptimize/');
Still results in the cache folder defined in Cache Info:
/wp-content/cache/autoptimize/
Any ideas?
hmmm, 2 things;
* i vaguely remember the place where you add the code in wp-config.php is important, try moving the define around?
* try with a hardcoded path first ('wp-content/uploads/' instead of ABSPATH.UPLOADS)?
frank
@futtta yes, that was it! It appears that AUTOPTIMIZE_CACHE_CHILD_DIR includes the wp-content folder; as a result, I was able to set the directory with:
define('AUTOPTIMIZE_CACHE_CHILD_DIR', '/uploads/cache/autoptimize/');
And that line of code must be inserted prior to:
require_once(ABSPATH . 'wp-settings.php');
Thanks again for the assistance!
My client is using Pantheon, a really nice development and hosting platform for WordPress. Unfortunately, while these edits worked… cache files with a .php extension are locked and not executed by the server.
Is there any means of changing the extensions of these files to .js or .css respectively?
Thanks!
tick the very last option, “Save aggregated script/css as static files?” and AO will switch to .js and .css Douglas.
I owe you a coffee (and then some!)
Updated to 5 stars, very appreciative!
thanks, have yourself a nice day (or night in your timezone now) Douglas!