We have seen this as a common question from clients, “I scheduled a blog post on my WordPress site to publish and it says it missed schedule, why did this happen?” In WordPress you can write a blog post and ask WordPress to publish the blog at a later time and date. WP Cron is how WordPress handles scheduling time-based tasks in WordPress. Several WordPress core features, such as checking for updates and publishing scheduled post, utilize WP-Cron. WP Cron does not run like UNIX cron jobs, it is only triggered on page load. So if your site does not have regular traffic, these WP Cron events can be delayed.
How did the blog publishing fail?
There are several reason why a WP Cron event, which publish the blog post, might fail. Here is a list of the most common reasons:
- Your web hosting provider is rate limiting the cron event runner. “429 Too Many Requests”
- Low traffic websites may not trigger the event runner often enough
- A fatal error caused by a plugin or theme may break the event runner
- A plugin or theme may intentionally or unintentionally break the event runner
- BasicAuth, a firewall, or other access restrictions may block the event runner
- A problem with your web hosting or web server may break the event runner
- The DISABLE_WP_CRON configuration constant is set but no alternative cron runner has been put in place
- Long-running events may temporarily block the event runner
- High traffic websites may suffer from sequential processing issues that block the event runner
From this list you can see its very apparent WP Cron jobs need a lot of nurturing in order to behave the way the user expects, and a lot of that falls on the hosting provider.
How do we find out what caused the failure?
The best way to check for the reason of the failure is to look at your hosting server error logs or access logs for any entries including the “wp-cron.php” file. If you are using a shared hosting platform you can request logs from the hosting provider.
How do we fix this this so it does not happen again?
A common way most people resolve the missed schedule issue is to install a plugin that attempts to republish the posts if they miss their timed posting.
Another way to resolve this issue is to setup a UNIX cron job on your hosting server to check for WP cron events that are due. If you go the UNIX cron job route you will want to disable WP Cron, which can be defined in your wp-config.php file. Here is the code needed to disable WP Cron via the wp-config.php file:
Here are two ways you can setup the UNIX cron job to run.
If WP-CLI is enabled on the hosting server:
cd /path/to/your/wordpress; wp cron event run --due-now >/dev/null 2>&1
cd /home/cpuser/public_html; wp cron event run --due-now >/dev/null 2>&1
If WP-CLI is not installed:
wget -q -O - 'https://example.com/wp-cron.php?doing_wp_cron' >/dev/null 2>&1
wget -q -O - 'https://personablemedia.com/wp-cron.php?doing_wp_cron' >/dev/null 2>&1
When setting the cron job in the hosting server you can set the cron to run at many different intervals. We recommend anywhere between 5-15 minute intervals for best accuracy and results.
We can help you with a WordPress website that works the way you expect it to. Fill out our friendly contact form or schedule a call with us below.