Have your scheduled posts ever missed their schedules in WordPress? Did you find a solution to the problem? How did you fix it (if you fixed)?
One of the issues people say they started to notice was the missed schedule errors since WordPress version 3.5. A lot of people have experienced this error after they implemented W3 Total Cache plugin.
Digging further, some people say the problem arises when Database Caching or Object Caching is enabled in W3 Total Cache plugin. There are many different opinions about it. However, it’s not clear if W3 Total Cache will ever be able to fix this problem.
I am going to explain this in a moment. However, let’s see how the mechanism works first!
How WordPress Runs Scheduled Tasks Using WP-CRON
The more you know about WordPress, the more you come to appreciate how much this little CMS does for you. It’s amazing how many things WordPress does in the background so that you and I can focus on producing content and marketing without concerning ourselves with technology too much!
One of the most powerful features in WordPress that most people don’t even know or discuss is the ability to run cron jobs using the WP-CRON.php file.
Every WordPress installation comes with WP-CRON.php file with functions to create/execute cron jobs that can help run scheduling tasks such as:
- Checking for theme & plugin updates (Now you know how plugin updates happen)
- Publish scheduled posts
- Sending pingbacks
- Executing scheduled WordPress emails to subscribers etc.
- much more…
Unlike regular cron jobs on any server which run at a specific time based on the server’s settings, the WP-CRON process runs every time someone visits your WordPress powered website.
This makes a WordPress site run properly on different kinds of server setups because it eliminates a lot of server-specific requirements. On every page load, WordPress checks to see if there is a need for WP-CRON to run. If there is a need, it tries to make a request over HTTP to the WP-CRON.PHP file.
While this works great for most part, it can have some issues for some people and missed scheduled error on your posts in WordPress is just one of them.
Issues With Cron Job Execution In WordPress
Here are some of the most common issues with WP-CRON that people run into although this list is not comprehensive:
1. Missed Scheduled Posts
This is the most widely reported issue on the web. It is the issue which I have faced often on my websites as well.
Usually, this happens after implementing W3 Total Cache (W3TC) WordPress plugin and the reason is very simple.
WP-CRON is supposed to be invoked when a page load is requested. When caching is enabled, chances are that the page is served through the cache and WordPress is not called upon to do anything. Thus, the cron job is not created causing the missed schedule error.
People who love using plugins or don’t know any better, seem to use a popular WordPress plugin called WP Missed Schedule Fix Failed Future Posts.
The plugin does a good job of identifying the posts that missed their schedules every 5 minutes and publishes them. This is a great way to solve this problem as long as you know how to install and activate a plugin in WordPress.
However, because it’s a plugin, that’s not the solution I prefer for the following reasons:
- Plugin conflicts can cause this plugin also to malfunction at times.
- It adds one more plugin to your WordPress making it a bit heavier especially since this is not the only way to fix the problem.
- If the plugin author doesn’t update the plugin, it may become a headache at some point in future.
I am going to talk about a better solution when we are done talking about these problems. Now, let’s continue discussing the other issues.
2. Scheduled Tasks Not Executing As Expected
You might have membership based websites where you have scheduled emails to go out to members based on certain criteria. All of a sudden you notice that those emails didn’t go out.
Sometimes, people complain that automatic membership renewal reminder emails don’t go out to their members.
Problems like that can also happen due to the exact same reason. If page load event is not registered, WordPress is not going to invoke WP-CRON.PHP thus missing scheduled executions.
Now, as you can imagine, you need one more plugin to solve this problem because Missed Scheduled Posts plugin isn’t going to help in this case. So, how many plugins you can keep installing, right?
3. Cron Jobs Not At All Executing
You will be able to identify that all of the scheduled tasks including missing post schedules aren’t happening because the WP-CRON is not creating any cron jobs due to incorrect setups or plugin conflicts. Sometimes, it could be because of the firewall on your server.
Again, this is just another way at talking about the same problem. WordPress isn’t going to execute any scheduled task if cron jobs are not even being executed.
4. Multiple WP-CRON Jobs Running On High Traffic Websites
On high traffic websites where WP-CRON.PHP is executing fine, this problem is more common and for obvious reasons.
Every page load is supposed to execute WP-CRON.PHP by definition. Now, if you have 20 thousand page views a day, those many times the cron job is being created and some of those can run for a minute and more.
This causes system administrators to get warning emails and sometimes, they see it as an issue based on overall load on the server.
5. Too Much CPU Resource Usage By WP-CRON
This is another problem that can cause overload on the server. Not only human beings but bots visit your web pages too. Do not forget the spambots!
Remember, your server is trying to executing WP-CRON on each page load irrespective of who is trying to visit the page.
This puts a lot of load on your server. Sometimes, depending on who your web host is, it can lead to resource usage problems for your server.
Why would you want your WordPress to run WP-CRON.PHP 20 times a minute? It just doesn’t make sense, right?
A Better Solution – One Solution For All Scheduling Problems
All of the above problems have one source – WordPress trying to invoke WP-CRON-PHP on page load event.
The ideal solution, I believe, will be to change the way WP-CRON.PHP is executed so you can have better control.
Whether you are on a shared hosting server or you have your own dedicated VPS or dedicated server, you should be able to easily achieve this. If you do not understand, you can always get help from your hosting company in getting this done.
Okay. Let’s talk about the solution now!
The idea is the disable the default behavior of WP-CRON.PHP execution and then schedule a new cron job to execute it every 15 or 30 minutes. You can also schedule it to run every 6 hours if you don’t have a frequent need to run cron jobs.
Step 1: Disable Default WP-CRON.PHP Behavior
This steps requires you to access your WP-CONFIG.PHP file to edit. You can get this file either using FTP or using your cPanel account. Once you have the file open, you are ready to edit this file.
Assuming that you know how to edit this file, you need to add following line into this file. I prefer to add this line right after define(‘DB_COLLATE’, ”); statement although you can decide your sweet spot depending on your preference:
/** Disable default WordPress cron execution plan*/
Now, save WP-CONFIG.PHP in your WordPress installation directory. The first step is now completed.
Step 2: Setup A Manual Cron Job For WP-CRON.PHP Using cPanel
Now that you have disabled the default behavior of the cron job execution by WordPress, it’s time to setup a new cron job on your server to execute WP-CRON.PHP at a regular interval. This cron schedule will consistently execute without any interruption.
According to some web hosting companies, having the WP-CRON.PHP script run every 6 hours is perfectly fine for most WordPress users. However, if your web host allows, you can schedule WP-CRON.PHP to be executed every 15 minutes or every 30 minutes.
Even if you execute WP-CRON.PHP every 15 minutes using an external cron job, you will only have 96 executions a day. Compare that with the load on server for thousands of executions a day if you have only a few hundred visitors a day per website on that server.
Follow these steps to create a manual cron job using your cPanel account:
- Log into your cPanel account
- Scroll down to find the Advanced section and then click on Cron Jobs icon as shown in the screenshot below:
- Enter an email address to receive notification in case of errors and also choose the time interval for your cron job in the Common Settings drop-down as shown in the image below:
As you can see, I chose 30 minutes interval as an example.
- Now, the most important step. Fill in the command (or set of commands) to create your cron job and click Add New Cron Job as shown in the screenshot below:
As you can see in the above image the a cron job is being created that changes directory to take control into your WordPress installation directory where WP-CRON.PHP is present and then it invokes the WP-CRON.PHP in quiet mode. The syntax is:
For example, if your hosting account’s wordpress is installed in “/home/user5”, your cron command will look like this:
If you have hosted a subdomain in a subdirectory within your “public_html” by name “subdomain1”, your command will look like this:
The idea is to make sure cron job goes into the directory where WP-CRON.PHP is installed and then executes the program.
At the end of this step, your WordPress website will be reliably and consistently running your scheduled tasks via the WP-CRON.PHP script, but only at set intervals. No more plugin conflicts or cache plugin effects will adversely impact your scheduled tasks.
If you think about it, what a relief knowing that your scheduled tasks are not overloading your server in anyway and also running consistently no matter which plugin is having error and which is running fine.
Your Turn To Share – Have You Faced These Challenges?
Have you run into issues of missed schedules on your WordPress installations? How did you handle it?
Do you any other or even more effective solutions to run scheduled jobs more reliably on our WordPress websites?
Please feel free to share your experiences and thoughts to add value. Thank you kindly as I look forward to learning from you!
I haven’t faced these challenges, mainly since I don’t schedule posts.
I have written posts in advance, but I usually come back and publish them myself, instead of scheduling it for later (this allows me to make re-edits, add some more information etc.).
But, I have ‘tasted’ the sweetness of not worrying about publishing – all the posting on auto mode; all we have to do is write, edit and schedule it.
I still prefer the normal publishing method though. But, that might change. I have decided to change my posting schedule to 2 posts a month (with shorter, snappier posts every now and then).
So, scheduling might help (I will be doing more writing for sure. Might be better if I didn’t have to worry about my own blog posts).
I have bookmarked the post, just in case 😉
Anyways, thank you for sharing this, Kumar 🙂 By the way, how have you been?
Good to have you back 🙂
Twice a month is not bad and in that case, probably you wouldn’t mostly need scheduling. However, it doesn’t hurt to be ready when situation demands!
Good luck to you and looking forward to your regular posts!
I use to have this issue a number of years back and I tried the plugin but it didn’t work. They still missed their schedule. Then after another WordPress update I didn’t seem to have this issue any longer. And by the way, I didn’t have a caching plugin then.
I didn’t even get a caching plugin until I moved to my VPS service this year because I still felt that it wasn’t loading as quickly as I would like so Ashvini installed W3 Total Cache. Probably just about two or three times this year alone my post has missed it’s schedule. So do you think I should worry about dealing with this code since it doesn’t seem to be something that happens all the time? I try to clear my cache on a regular basis just so things will run smoothly.
This is interesting to know though and I’m not surprised at just how complicated WordPress can be. There is just so much to it that I have no clue about obviously.
Thank you though for sharing this information with us. I can probably do this myself but not sure it I really need to, at least now.
Enjoy your week.
You have a busy website and probably it makes sense for that reason to get this done. Why let WordPress consume CPU resources when it could consume less of that?
Like I said, if you have 1000 pageviews a day and you have another 1000 bots visitors, your WordPress is trying to run that WP-CRON.PHP 2000 times a day. Is it really needed? Probably not.
I don’t have much of a problem of missed schedule because I don’t schedule my blog posts very often either. But then, CPU cycles are important to me especially since I have a hosting company. So, I wanted to get it done for my website. I also keep an eye on these things for my client website’s too and if any of those websites start to have too much traffic, I will communicate with the owners and get this change done for them as well.
It’s just a good thing to have although not something that will harm you or your business if you don’t do immediately.
However, if you had a more complex website and you wanted to send some scheduled emails to your community members or if you had an eCommerce implemented where automatic payment reminders were needed to be sent etc., depending on WordPress’s default cron job execution could be problematic.
I hope this helps a little? 🙂
While this was way over my head, I read your response to Adrienne and realized that’s how you know when my blog is in trouble. I always wondered how the heck does Kumar know something is going wrong and there is an email I get from you! AHA…that’s how you do it! I can understand the importance of having this.
For me, I only blog once a week and don’t ever schedule posts. I have a few on a document …just in case something happens, but that’s it.
Besides, you know me…I get all confused when it comes to this. That is why I hired you and I must say, I’m always amazed how you know things are going wrong on my blog and tell me immediately. Your service is the best!
Thanks so much!
Managed Hosting is all about making sure all websites I host (whether they are my own or my client’s who trusted me with their websites,) run smoothly and I take care of their issues just like I would if it were my website.
So, I use same methods to measure of every website I host and the moment I notice a problem with your site, I get in touch with you 🙂
Thank you for the compliments. I really appreciate you for the kind words you always have for people and the way you always encourage other people (in this case, me!)
Have a wonderful new week!
Wow, that’s a detailed how to you have here.
The first time I ever tried to schedule a post on WordPress it totally didn’t publish my post, so I never ever tried again, because it didn’t make any sense and I had not time to figure it out. So I will save this post 🙂
At times I really hate WordPress, like right now, for example. This morning I updated my WP and guess what happens now? My comments count is showing but the comments are not visible. This is the kind of issues that drive me crazy. By the way if you can help me understand what’s going on I would really appreciate it.
If you still have that issue, send me your admin login details in an email and I will check this out for you. It should be something trivial, it doesn’t deserved to be hated for that 🙂
Oh, you’re an angel, Kumar. Yes I was hoping that it would be gone this morning 🙂 but no such thing, still unable to see any of my comments. I’ll send you that through facebook PM.
Thanks bunches 🙂
Kumar, have you tested these settings on a transactional site, such as a member site or one running e-commerce? Thinking it would be good for both. I know that WishList Member suggests that you create a custom Cron job to run every hour. But, they neglected to mention about turning off the default in the wp-config file. Does that set up any conflict?
Yes, I have. I just implemented this solution for one of my major clients with about 6K subscibers on a membership website with a lot of digital products. They have daily traffic of about 3K daily unique visitors. It’s huge website and the moment I implemented this on their server, their resource usage came down significantly.
This method will work in any environment and if you need to have it run more frquently, you can schedule it to run every 5 minutes and it will still be much better than default method.
I knew about the importance of WP-CRON but never thought that there could be problems when scheduling the posts, especially when I too have W3TC installed. Thanks for letting us know about the plugin to fix the problem, which will be very handy for people who cannot follow the technical procedure. But you’re right that it’s better to avoid plugins as much as possible.
I did have problems with not all cron jobs executing at Aha!NOW and I guess I need to try your described procedure to see if it works as a solution, more so with a membership-based community over at the blog. More importantly, I’m really interested to reduce the CPU resource usage.
Thanks again for sharing this useful information. Have a great day ahead!
Whether or not scheduled posts fail, for a busy website it is important to save some CPU cycles and this definitely does the trick. I have seen CPU usage coming down significantly with this change and I am sure you will notice the same effect when you make this change.
Please let me know how does this affect your overall CPU/resource usage when you make this happen 🙂
Thank you for stopping by.
Nice post you have shared. I usually don’t schedule post, but some time for the busy schedule I schedule a post. I never Face this problem before. I bookmark yout article that can be helpful to me in future. I also recommend your article who have told me that they are facing post schedule problem in wordpess. Thanks for shairng..
Good to hear from you.
Well, even if you haven’t faced this problem so far, you will now not get into panic mode if it ever happens because you know what to do when it happens 🙂
I have never faced such type of problems because I don’t schedule my posts. I write them in advance and post them whenever I feel like good time.:)
But after reading this post I came to know about another good plugin which can be used when bloggers schedule their post and face problem. Few of them may face missing schedule problem. They need to use this plugin.
I am fond of WordPress and it amazes me every single time. And after knowing about another new file I am really surprised.
Thanks for writing this post.:)
Hope you have a great week ahead.:)
Hello Gauwaw Sir,
I have not faced this type of issue. But I have another issue about W3 Total Cache.
Actually I installed Adsense Publisher plugin to add adsense ads but when I click on ads manage, an error occur in which says, may be W3 total cache plugin is installed, please clear website cache through W3 total cache, and then manage ads.
then I cleared cache but the problem is still occur. Please help me in this regard or suggest me best adsense ads management plugin.
Thanks in Advance.
Looking forward to seeing more of this series as I begin to get deeper into WordPress development myself.
There is a certain time in a day when each site gets the peak of their users. Now if you live in a different time zone than your readers, then it can be a problem. Imagine having your peak time as 3 a.m. Scheduling posts can be very handy for this.Thank you for this post. I thought I had to install a plugin to schedule posts, I had no idea that it was so simple!
Thanks for sharing this. I had some issues with it too and I am going to try this out! Hopefully this solve any post issue from now on.
I wish you had published this much earlier! Haha!
Happy week ahead Kumar.
It will Reginald! It did for me because I had this problem for a long time.
Initially, I didn’t pay much attention to it since I don’t usually schedule my posts too much.
But then, while working on a client website I faced this challenge and then I couldn’t ignore. I found this solution and it works like charm!
Let me know how it goes for you 🙂
this is my first visit on this site, thanks for sharing this info here, my friend facing such type of problem, but now i gonna share this url to him. here he will get the perfect solution for his web. love to share it. 🙂
Hey Gauraw. This is seriously an awesome post. I almost everytime encounter this issue. The post will not be publishedas expected.
The cache plugins like WPTC or WP Super Cahceoverrides many plugins and functionalities of WordPress.
I didn’t knew that future scheduled posts are also affected with these caching plugins. Nice to know about “WP Missed Schedule Fix Failed Future Posts” plugin, will give it a try!
Apart from these, caching plugins also interferes with various plugin functionalities like XML Sitemaps functionlaity in WordPress SEO plugin.
Have a great weekend.
Hey there Hi once again,
I publish 3 to 4 articles per week on my blog which runs wordpress
i use to shedule the articles and they were not getting published
but now i think it is fixed.
Good article this problem i have faced your article has helped me alot also i have shared article on my blog that how to transfer wordpress site to new host you can check visiting my website pointouttech
I tried the plugin option, but had a ton of issues with error messages. Just tried the script you supplied, and it looks like it’s working now. Thanks so much for posting this!
If anyone’s hosting provider doesn’t allow setting cronjobs and you’re looking for a simpler solution, you might consider a webcron services(like easycron.com) which will load wp-cron.php at a given time.