How To Delete Thousands of Crons in WordPress

I previously posted how to fix missed scheduled posts, this time on a related but different note I’m going to show you how to delete thousands of cron jobs all at once.

Now you must be asking, how did I get thousands of cron jobs? Well, I had a defunct plugin that was adding in new cron jobs over and over. I used Improved Cron to check out why my cron jobs weren’t firing, and found that it was flooded with cron jobs.

What’s interesting to note is a lot of plugins will add a cron job, but when you remove the plugin it doesn’t remove the cron job. So over years you can start to have a ton of junky cron jobs in there slowing everything down.

Delete WordPress cron jobs with phpMyAdmin: if you are familiar with phpMyAdmin, simply goto your WordPress database and open up the wp_options table. Do a search for crons.

1-26-2016 1-23-29 PM

Once you find the cron, simply delete it. Scary, but actually WordPress will automatically re-generate the field when necessary.

1-26-2016 1-23-46 PM

If you don’t know how to use phpMyAdmin, or are simply too scared, a neat trick you can do is to add this one line of code to your WordPress Theme functions.php file. If it doesn’t have it, then you can add it to any of the plugins:

delete_option( 'cron' );

Once you or anyone accesses your blog, this will delete that field. Then remove the code and you’re good to go! Now after doing this my cron jobs run much smoother.

One thought to “How To Delete Thousands of Crons in WordPress”

Leave a Reply

Your email address will not be published. Required fields are marked *