When scheduling posts within WordPress you rely on WordPress to work and get the post published for that time. Unfortunately relying on WordPress from the word ‘go’ doesn’t always work. In this post I walk through a fix for the ‘Missed Schedule’ error within WordPress.
If WordPress is unable to run the processes to publish scheduled posts then they are shown in the admin with ‘Missed Schedule’. Not very helpful at all. You can hit the wp-cron.php file yourself which will run the necessary process to get the post published. Another alternative is to set up a cron job to hit wp-cron.php at set intervals.
After some digging however you can change the method WordPress runs the wp-cron.php file by adding the following to the wp-config.php file…
Wordpress will run the following process to publish scheduled posts…
- Visitor hits your site.
- WordPress checks if WP Cron needs to run.
- If it does then it uses an alternative redirect method (which does slow down the site loading for the 1 user).
- The post is published and the site loads for the visitor, with the post shown (depending on page/theme etc).
If ‘ALTERNATE_WP_CRON’ isn’t set then the default process runs to publish sheduled posts, which looks like the following…
- Visitor hits the site and the page loads.
- WordPress checks to see if a wp-cron needs to be run.
- If one does need to be run then it tried to make a HTTP connection back to itself calling the wp-cron.php file. Which is why the first visit to the site won’t contain the post that needs to be published as WordPress is running this in the background.
In my personal experience this week it’s this HTTP connection that didn’t work, which meant the post wasn’t published till I hit the wp-cron.php using my browser.
So if your experiencing the ‘Missed Schedule’ posts try adding the below code to your wp-config.php file.
Apoligies for the wording of this post, it was written quickly and late in the evening/early morning. I hope it helps someone.