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

WordPress Cron Schedule the if and else statement

wp_cron is a PHP level system and so also only runs on page load. It does not run on clock time so you’d still need to reload the page to get the loop to run. Second, to get this working with wp_cron you’d need to pull all of your posts with _limited_dates_to set and loop … 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

Trigger a cron every 24h GMT -8

Almost, WP Cron jobs do not run at specific times, they are approximate, and all timestamps should be UTC, as WordPress always deals in UTC timestamps. If you want midnight PST, you’ll want to specify 8PM UTC. Also for example, your above code suggests midnight PST, but it may not run at midnight PST. If … Read more

WP Cron emails not working

This should be a comment, but I don’t have comment privelages 🙁 I had this exact problem not long ago, and felt stupid when I realised it was because I had set a password on the directory…

WP CRON runs only the first time

OK, so I’ve tested your code and I’m pretty sure it can’t run even once… And here’s why… If you’ll take a look at wp_schedule_event you’ll see this check at the top of the function: if ( !isset( $schedules[$recurrence] ) ) return false; It means that you can’t schedule event with unknown recurrence. So let’s … Read more

Cronjob not working as expected – issue with hook?

Unfortunately the WordPress cron jobs are only triggered when your site is visited (see Codex): The action will trigger when someone visits your WordPress site, if the scheduled time has passed. I believe this to get around the fact that many on shared hosting aren’t normally allowed to set up cron jobs (at least, not … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)