Have you written a killer post, which you scheduled to get posted at the perfect time, and then a few hours after it was supposed to be posted, you got online, only to find out that the article never got posted?
Frustrated, you went and checked your post drafts section of WordPress, and saw the following error:
When scheduled posts are written to go “live” at a certain time, this is not the error you want to see.
Tragically, this has been happening to me recently on some of my blogs. While the easy fix is just to immediately publish the post, this doesn’t work if you are going to be away from the computer for a few days or a week or more, and want to schedule posts in advance.
Recently, I was planning on taking a week break from blogging, but still wanted articles to get posted every day. So I had to write and schedule them in advance. However, none of my schedules articles were actually getting posted. Instead, they kept getting the “missed schedule” error.
So I wasted about six hours trying to find out what was wrong. I went through the usual steps, and uninstalled all my plugins, re-installed WordPress, searched the help forums, and everything else I could think of. I found lots of people who had similar problems, but nobody had a real solution.
Finally, I figured it out, and although you may not be dealing with the problem, I am writing a post about how I fixed it just so that if this ever happens to me again, I don’t have to waste hours of my time trying to remember what I did.
First, I learned that scheduled posts get posted through a WordPress file called “wp-cron.php.” It is found in your WordPress root directory.
So, if your blog is found at www.wonderfulblog.com, then the wp-cron.php file is located at www.wonderfulblog.com/wp-cron.php. This file needs to be “pinged” by something to make scheduled posts get posted.
WordPress is supposed to do this automatically. But sometimes, a blog host has additional security which keeps this file from doing what it is supposed to do. Apparently, my host, Omnis.com, happens to have this additional security. So, I had to create what is called a “Cron Job” in my Host Control Panel which would ping the wp-cron.php file every fifteen minutes or so. If it did this, the latest an article would get posted is 15 minutes after it was supposed to.
Here is the command I used to tell the cron tool to ping my file every 15 minutes:
But when I did this, there was still a problem. The command timed out without accomplishing anything.
What was the problem now?
As it turns out, there is another file in WordPress which was timing out before it could accomplish its task. This was cron.php in the /wp-includes/ folder. It comes from WordPress with a 0.01 timeout, which meant that it was timing out before it could accomplish anything.
So, using an FTP program like FileZilla, I found the file and edited it.
Once I opened the file, I found the line which said this:
wp_remote_post( $cron_url, array('timeout' => 0.01, 'blocking' => false, 'sslverify' => apply_filters('https_local_ssl_verify', true)) );
And changed it to this:
wp_remote_post( $cron_url, array('timeout' => 1.00, 'blocking' => false, 'sslverify' => apply_filters('https_local_ssl_verify', true)) );
Then I saved the file, and now, whenever I schedule a post, it actually gets published. No more missed schedule posts! Yay!