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.