Delete thousands of cron jobs

Thanks Privateer for the prompt reply and advice.

I found a way around it before I saw your answer. Here is a step-by-step method for deleting thousands of old cron jobs and may be of use to someone else.

I logged on to phpMyAdmin. I clicked on my database and then the ‘search’ tab. I typed in ‘cron’ then selected ‘all tables’ and clicked ‘Go’. I scrolled down the search results list to my wp_options table. I clicked ‘Browse’. At the top of the list was option_name ‘cron’. I clicked ‘Edit’ then waited for the page to load. I clicked on the box that showed the list of cron jobs. The cron list was so long that it took about 80 seconds for my cursor to respond. I then used Ctrl-A on the keyboard to select all before hitting the delete button. It took about 2 minutes before my browser completed the deletion (chrome timed-out so I tried Firefox which worked).

After another couple of minutes the cron jobs for my current active plugins re-populated the list. There were 9 cron jobs (down from over 29,000!). Six years of duplicate cron jobs from badly coded plugins, some of which I just installed for a day to try out. Also hundreds from common plugins such as Wordfence, BackupBuddy, Nextgen Gallery, and AutoOptimizer – all of which I had uninstalled in the past. My site now loads like it’s been turbo-charged. The admin area is much quicker. Admin timeout errors have disappeared. I had spent so much time on optimising my website trying to decrease the load time. I even moved hosts and upgraded my hosting plans. Nothing increased the speed of my site like deleting all the outdated cron jobs. Mobile download time decreased from 20 seconds to 6 seconds. Desktop download time decreased from about 12 to 4 seconds.

In my search for a solution I found very little information on the effect of cron jobs on website performance. Many said it made little difference and for a small number of cron jobs that’s true. But years into the life of a WordPress site I wonder how many are bloated with hundreds if not thousands of old cron jobs from deleted plugins. Instead of asking users to check their php memory limit I would suggest that developers first ask users to check the number of cron jobs in wp_options when problem-solving fatal memory errors. You may be surprised/shocked at what you find! 🙂

Leave a Comment