Run W3 Total Cache Flush Function with Crontab [closed]

Here’s how I would go about doing this: First create a file with a hash for the file name within your theme directory – this one is md5(‘foobar’): 3858f62230ac3c915f300c664312c63f.php Within that file would be something like this: //Use the file name as an API key of sorts $file = explode(‘.’, basename(__FILE__)); $key = $file[0]; //Trigger … Read more

Schedule event every second thursday of the month

WordPress lets you add custom cron schedules, which is normally what you’d want to do in this situation, in conjunction with wp_schedule_event(). But, they work based on intervals rather than specific dates/times. For instance, add_filter( ‘cron_schedules’, ‘addCustomCronIntervals’ ); function addCustomCronIntervals( $schedules ) { $schedules[ self::PREFIX . ‘debug’ ] = array( ‘interval’ => 60 * 2, … Read more

Run function at specific time

you can absolutely use wp_cron to specify a time: add_action( ‘my_scheduled_event’, ‘prefix_my_scheduled_event’ ); /** * On the scheduled action hook, run a function. */ function prefix_my_scheduled_event() { // do something } //going to use the strtotime function, so a good habit to get into is to set the PHP timezone to UTC default_timezone_set( ‘UTC’ ); … Read more