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

Cron jobs for deactivated plugins

This might be because the plugins you were using didnt deregister the crons it setup. To remove the crons use the following code in your functions file: add_action(“init”, “clear_crons_left”); function clear_crons_left() { wp_clear_scheduled_hook(“cron_name”); } Once thats run once you can safely remove it

get_posts inside cron

Whenever you do get_posts or WP_Query or anything like that, it’s important to remember that the code is actually getting all of the Posts at once, and loading them from the database into memory. If you run out of memory, then your process will simply die with an error. Attempting to get very large numbers … Read more