• Hello,
    I have some code that may or may not flush the cache automatically and wanted to check with you folks first. I am not sure it will work and I don’t want to corrupt my functions.php file.

    // 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' );

The topic ‘Automatically Purge’ is closed to new replies.