• Resolved marianssen

    (@marianssen)


    Hi!

    I’m having issues setting up automatic cache flush on ACF options page update. Below is the code i’m using, but it is returning NULL on the $w3_plugin_totalcache->flush_al function.

    function tj_flush_w3tc_cache() {
    	$w3_plugin_totalcache->flush_all();
    }
    add_action('acf/save_post', 'tj_flush_w3tc_cache', 20);

    Thank you for your suggestions.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @marianssen

    Thank you for reaching out and I am happy to assist you with this.
    This may not be needed with the upcoming W3 Total Cache update. It includes many improvements to both the object cache and DB cache that should accomplish the auto flushing for ACF setting/field updates.
    The upcoming update goes much further as it separates the various post types including things like options, meta, etc. into separate entities that only clear during specific actions. For example with ACF, if you were to update the settings or field configurations it would clear the cache only for options / CPT. Currently, W3TC doesn’t clear the cache for CPT changes or for option changes which means that options can get cached and require a manual clearing of the cache
    As what you are trying to achieve with the filter needs to be tested, I’ll have to get back to you on this once the tests are done.
    Thanks!

    Thread Starter marianssen

    (@marianssen)

    Hi @vmarko,

    thanks for the quick reply! When is the new version going to be available?

    Thanks

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @marianssen

    You are most welcome.
    The next patch update should be released soon after the tests are done. I cannot specify the exact date unfortunately but it should be within the next two weeks.
    Thank you for your patience.

    Thread Starter marianssen

    (@marianssen)

    @vmarko okay, that sounds good ?? One last question – is it possible to purge all cache automatically max. every 4 hours? Some plugin require this – Caldera forms at least can have some issues when the cache is not purged. I did not find the option for this in plugin options. What would be the functions.php code for this?

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @marianssen

    Thank you for your feedback.
    To reliably schedule something – he should use Unix cron and call to w3tc_flush_all(); every x hours.
    Thanks!

    Thread Starter marianssen

    (@marianssen)

    Hi Marko,

    thanks! One more question – couldn’t I just use the same function inside my function, e.g.:

    function tj_flush_w3tc_cache() {
    	w3tc_flush_all();
    }
    add_action('acf/save_post', 'tj_flush_w3tc_cache', 20);
    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @marianssen

    Thank you for your question.
    As I’ve said in the first reply, this needs to be tested as this is not a suggested way of doing this.
    I’ve seen similar things online however, this is not suggested by the devs.
    This is why I suggested the Unix cron and scheduled w3tc_flush_all(); call
    Thanks!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Flush all cache on ACF options page update’ is closed to new replies.