How do you change the default cache path

Hey I hope someone might be able to help.

I’ve just updated acorn to v3 and prior to this i was using the following adding the following filter to functions.php to change the cache directory as the host I’m using doesn’t allow me to use wp-content.

 add_filter('acorn/', function ($path) {
    return '/tmp/sage-cache/';

It looks as though this filter has changed/removed and I was wondering what is the best way now to change the cache path?

Many thanks

If the filter isn’t running early enough it might not work. You can set the ACORN_STORAGE_PATH constant instead of using the filter.

Thanks for the reply.

Should the filter still work? Its just that in acorn v2 in BootloaderTest.php

$this->filter('acorn/', fn () => temp('storage'));

And in acorn v3 i can’t find that or similar. If it should and its a case of not running earlier enough where should i put it so that it does?

If i was to use the constant instead where would the best place to put it within the theme?

I really appreciate your help.

The acorn 3.x specific cache configuration can be found here, IMHO:

1 Like

If you’re using Bedrock, you can define ACORN_STORAGE_PATH in your config/application.php. If you’re not using Bedrock, you can define it in your wp-config.php file.