[UPDATE] Fixing Missed Schedule Issue in WordPress

In Guides by Bintoro Adi GunaLeave a Comment

hero

[UPDATE 1, December 31, 2023: I found a mistake in the cron job command. A fix has been made.]

Anda berbicara Bahasa Indonesia? Baca artikel terjemahannya di sini!

WordPress’ Schedule Post feature is very useful for me. I usually write post drafts, and schedule the publish dates later, so I can have publish new contents regularly. This is also easier for me, since I can just draft anything on my mind whenever I found something interesting, then schedule them later for publishing. This can also give me more time to edit / format posts when the situation calls for it.

Unfortunately, lately, this scheduling feature somehow stopped working. I just got Missed Schedule errors on my scheduled posts, forcing me to publish them manually. Well, since this feature is pretty significant for me, I spent a few times deep diving into the error… and here are my findings:

Missed Schedule: Why It Happens

missed-schedule-error

Basically, WordPress has a pseudo-cron system called WP Cron. I called it pseudo because it’s not a real cron, which is executed at a fix time from a server. Instead, it waits for a visit to trigger. So, in conclusion, if there’s no visit, then it won’t trigger.

However, despite me visiting my sites with different devices, it still won’t trigger. Some sources say that this error may somehow be caused by caching plugins. That makes sense, since caching plugin works by prioritizing loading the cache instead the real files. These “caches” may skip running the WP Cron script for some reason. However, even after clearing the cache, it still won’t trigger.

Well, I give up. Let’s leave WP Cron for now, and try some alternative solutions.

Missed Schedule: Mitigation

Before attempting any of these solutions, it’s very recommended to turn off WP Cron by default, so your cron won’t be triggered twice. You can do this by editing your site’s wp-config file by adding the following:

define('DISABLE_WP_CRON', true);

If you, for whatever reason, decide to turn WP Cron back on, you can just replace true with false, or delete the code overall.

Using Scheduled Posts Plugin

scheduled-post-plugin

The simplest way for fixing this error is by installing this little plugin called MWW Scheduled Post Trigger. This plugin keeps being recommended and the reviews, active installations number check out. It’s also maintained regularly.

Basically, this plugin works like WP Cron, checking for posts that have missed their schedule and post them when your site receives a visit. However, this should be more reliable since plugins are configured to load with the website, and doesn’t seem to be affected by caching.

Using Cron from Hosting

cpanel-cron-job-menu
If your hosting allows you to configure your own cron, it should appear in cPanel.

If you don’t want to use additional plugins (like me, for performance reasons), we can set up cron jobs to directly call the WP Cron script (though disabled earlier, we can still execute WP Cron manually). We can set this up directly from your hosting service. Here’s how you can do it on cPanel:

  1. Look for Cron Jobs from your cPanel.
  2. Set up the Cron Schedule (I use once every 5 minutes, your needs may vary), and use the following command:
/usr/bin/php -q /home/path/to/wp-cron.php >/dev/null 2>&1
  1. Save the cron job.
cron-job-cpanel
cPanel makes it easy for you to configure your own cron job.

Done, now you can wait until the scheduled time and verify if it works.

Using Cron Service

easycron-pricing
If your hosting doesn’t allow you to configure your own crons, there are free alternatives out there.

Some hosting providers don’t allow its users to configure cron jobs for performance reasons. If you’re using this one, and you still want to use crons, you can try free cron services, such as cron-job.org or easycron.com.

The process should be similar to the previous step, and if you’re confused about the cron duration expressions, you can use crontab.guru to help you. They even have some examples to get you started.

crontab-guru
Crontab Guru is a godsend when trying to figure out your cron schedule / interval.

Conclusion

This missed schedule error in WordPress is significant to me since I won’t be able to plan my posts reliably. Thankfully, the second trick did the job for me. Hopefully, one of those tricks above can also help you fix your post scheduling problem.

Well, I guess that’s all for now, Folks. Hopefully this article is able to solve your missed schedule problem in WordPress. As usual, if you have questions or comments, don’t hesitate to ask them in the section below. Finally, thanks for reading, and see you in the next article!?

Leave a Comment