• Hi there

    I would like to automatically purge my cache every hour via a cron job.

    I have seen some code to do this via the functions.php:

    $w3_plugin_totalcache->flush_all();

    Full code is :

    // Scheduled Action Hook
    function w3_flush_cache( ) {
    	$w3_plugin_totalcache->flush_all();
    }
     
    // Schedule Cron Job Event
    function w3tc_cache_flush() {
    	if ( ! wp_next_scheduled( 'w3_flush_cache' ) ) {
    		wp_schedule_event( current_time( 'timestamp' ), 'daily', 'w3_flush_cache' );
    	}
    }
    add_action( 'wp', 'w3tc_cache_flush' );
    

    This doesn’t seem to work for me – does that need to be instantiated somehow?

  • The topic ‘Automatic purge of W3 Total Cache via functions.php’ is closed to new replies.