WP-Cron Not Working? Here the Fix

I had an issue with WP-Cron, it stopped worked for few days. I didn’t notice when it actually stopped. If I know that, then it would be easy to fix that problem. Here my story what are all the problems that I have faced because of wp-cron and how I fixed it.

Problems that I have faced because of Wp-Cron:

Wp-cron and Google XML Sitemap:

Once I checked my Google XML Sitemap, I was shocked! because this plugin is not updating my latest blog post on sitemap file i.e sitemap.xml.

Here the exact error message I was receiving

Your sitemap is being refreshed at the moment. Depending on your blog size this might take some time!
Due to limitations of the WordPress scheduler, it might take another 60 seconds until the build process is actually started.

I can build sitemap manually, but it’s not happening automatically. After searching lot on Google, I still didn’t get an answer to my problem. I noticed the lot of other users also facing similar issue, but no one have a right solution to solve this problem.

Because of this issue I removed this plugin and started using WordPress SEO by Yoast. Here I don’t faced any such problem.

I never know that WP-cron is causing an issue to update xml sitemap here.

WP-cron and WP Scheduled Posts:

The next problem that I have faced because of wp-cron was, WP scheduled posts. Every time I schedule the post, the post started skipping that scheduled time, and after skipping that time, in WP posts dashboard it started showing “Missed Schedule” message under the date.

wp schedule post missed schedule


Again I searched Google, still I didn’t get any proper solution. In some post they were showing install plugin to fix that issue, but I was  not ready to install any plugin to fix this issue. So this issue also left unfixed.

I never used scheduling feature much, so I didn’t bother much about this issue.

Now with BackWPup Plugin:

After some days I came to know about awesome wordpress plugin called BackWPup. I installed this plugin on my site, when I tried to schedule automatic backup using wp cron function it is also started skipping the schedule to backup.

wp-cron-not-working

Here I got the clue that something is wrong with my wp cron itself.

When I started digging solution to fix WP cron problem, finally I found the solution for it.

The Problem that Caused WP Cron to Stop Working:

The problem that causing to run wp cron was, the code that I had placed on .htaccess!

Here the exact code

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{QUERY_STRING} .
RewriteCond %{QUERY_STRING} !^(s|p)=.*
RewriteCond %{REQUEST_URI} !.*wp-admin.*
RewriteRule ^(.*)$ /$1? [R=301,L]
</IfModule>

After remove that code from .htacess file all the above problem stopped, and my wp cron started working again.

How you can fix?

The above code snippet or mod_rewrite rules was causing some problem for wp cron to run. I’m sure there can be other modified version of such code can be present on your .htaccess file. Go and replace your .htaccess with default .htaccess and check if the problem is fixed or not. If fixed, then go and verify the code which is causing that issue and remove that code.

If this is not worked, then try by disabling all your plugin and check once. If this is also not worked, then try by switching to a default theme and try. If this is also not worked, then try replacing all your wordpress files.

This is not an issue of wordpress, this is our issue, go and investigate what causing such issue instead of blaming on wordpress.

Click Here to Leave a Comment Below 3 comments
FoulSpeakers - January 16, 2017

I disagree that this is not a problem with WordPress. WordPress created the mod rewrite rules and wp-cron, so they should have built them to run together. For SEO reasons I will not change my mod-rewrite rules and will look for another solution. I think it might have something to do with the amount of data being processed. I am using WP Robot to auto-post content from social media. The site is not live yet, but the post count is over 5,000 and WP Robot checks for duplicate content and stuff like that. My best guess is that there is some default setting that won’t let it process too much and I am just not Googling the right terms to figure out what that is. I know that wp-cron is the culprit because everything else works fine. I can run a campaign manually, but nothing that uses the wp-cron fires anymore.

Reply
Hil - October 31, 2017

True. Removing IfModule lines do not fix the problem of WP Cron not running. I am having the same problem since 10/18 and none of the wp cron jobs are running. The only common denominator is that all problem sites are on Ipage Hosting (1and1 and hostgator are fine).
I managed to use this solution to fix the wp cron issue https://wp-mix.com/wordpress-cron-not-working/ , although now as you surf my sites some of the URL look like this ?doing_wp_cron=1234567890.09876543210987654321.. which affects SEO

Reply

Leave a Reply: