Bringing back North Ocean Hotel’s website after the 123-reg debacle
May 18, 2016Top ways to avoid WordPress comment spam
May 25, 2016Anyone who works with WordPress will have seen the message ‘missed schedule’ on their posts page at one time or another. It is one of the most annoying aspects of what is otherwise a very competent content management system. Here’s how to fix it.
How post scheduling works
First, let’s take a quick look at how post scheduling is set up. When you set a post to publish in the future, it gets set to scheduled rather than published. A cron job is set up by WordPress to trigger at the date and time you specified when setting up the post.
WordPress uses a UNIX cron job to maintain its current state. Cron is a task scheduler that triggers every time a page is requested. Cron jobs publish scheduled posts, perform maintenance and a range of other tasks. When cron doesn’t run the publish task properly, you get the ‘missed schedule’ error.
In WordPress, cron is controlled by WP-cron. Every time someone visits the site and requests a web page, WP-cron.php is triggered. The front end of the site works as normal while the cron job is processed at the back end. This ensures full operation of the site and low server overheads for CMS.
How does WP-cron affect missed schedule posts
There are a couple of reasons for the missed schedule error. One, if the website doesn’t have a lot of traffic, the cron job doesn’t get triggered. This is a common error for newer websites.
There are also scripting errors within WordPress or cron itself that can cause these issues that I have seen on high traffic client websites.
How to permanently address missed schedule post errors
There are quite a few websites that talk you through adding a manual cron job or modifying cron through cPanel, or using a specific plugin to address it. None of these are strictly necessary as there is much a simpler way of fixing the majority of missed schedule post errors.
Just follow these steps:
- Log into your web hosts cPanel or equivalent
- Click on Cron Jobs and select Add New
- Select ‘every hour’ or ‘every day’ depending on how busy your site is
- Paste the following into the Command window:’wget -O /dev/null http://www.YOURSITEURL.co.uk/wp-cron.php?doing_wp_cron > /dev/null 2>&1‘ (without quotes of course)
- Select Add New Cron Job
For example: the code for this website is:
‘wget -O /dev/null https://coastalcontent.co.uk/wp-cron.php?doing_wp_cron > /dev/null 2>&1‘
Check that wp-cron is located at http://www.YOURSITEURL.com/wp-cron.php. If it isn’t, change the URL structure accordingly
Once the new job has been saved, schedule a post for some point in the future and keep an eye on it. If you have done it correctly, it should publish as normal. That’s it!
I use this hack to fix missed scheduled post errors on every site I manage and it works every time. I hope it works for you too!