• Resolved thomasv85

    (@thomasv85)


    Is it possible to automatically clear all cache every 4 hours? With a cronjob or with a code in functions.php?

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

    (@vmarko)

    Hello @thomasv85

    Thank you for your inquiry and I am happy to assist you with this.
    To reliably schedule something you should use Unix corn, as this depends on your control panel you should reach out to your host for assistance in creating a cron that will call function w3tc_flush_all every 4 hours in your case.
    Thanks!

    Thread Starter thomasv85

    (@thomasv85)

    I can make a cron job, but what would be the link for the flush?
    Do you have a example?

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @thomasv85

    The function is in /wp-content/plugins/w3-total-cache/w3-total-cache-api.php on line 233:

    /**
     * Purges/Flushes everything
     */
    function w3tc_flush_all( $extras = null ) {
    	$o = \W3TC\Dispatcher::component( 'CacheFlush' );
    	$o->flush_all( $extras );
    }

    Thanks!

    Thread Starter thomasv85

    (@thomasv85)

    do you have a example for the cronjob?
    so a link or a code that i can use in the cronjob…

    something like:
    59 23 * * * curl –header ‘Cache-Control: max-age=0’ http://your-domain.com/wp-content/themes/your-theme/3858f62230ac3c915f300c664312c63f.php >> /home/myuser/w3tc-flush.log

    Thread Starter thomasv85

    (@thomasv85)

    Do you have a cronjob example?
    I don’t know what you mean with the code..

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘automatically clear all caches’ is closed to new replies.