Cron Job (crontab) – WordPress Solution – Speed Up WordPress website

  • Home
  • Cron Job (crontab) – WordPress Solution – Speed Up WordPress website

Cron Job (crontab) – WordPress Solution – Speed Up WordPress website

We usually encounter with Cron Job and most of the people don’t know how much it can impact Speed of WordPress website if you did wrong with Cronjobs.
In this blog we’ll discuss about how we can delete unwanted crons in correct manner from WordPress.

Speed Up WordPress website by Cron job removal

It made little difference for a small number of cron jobs that’s true but years into the life of a WordPress site one must bloated with hundreds if not thousands of old cron jobs from deleted plugins. Now, instead of suggesting to increase the php memory limit I would suggest that first check the number of cron jobs in wp_options when problem-solving fatal memory errors. It may be surprising if you find a lot of Cron Job.

Here is a step-by-step method for deleting thousands of old cron jobs that I would like to share with everyone.

  • Log into phpMyAdmin
  • Select the used database and then the ‘search’ tab.
  • Type ‘cron’ in search field then select ‘all tables’ and clicked ‘Go’.
  • Scroll down the search results list to my wp_options table.
  • Now, click ‘Browse’.
  • At the top of the list was option_name ‘cron’.
  • Click ‘Edit’ then wait for the page to load.
  • Now, click on the box that show the list of cron jobs.
  • The cron list was so long that it may take some time to respond.
  • Select all crons using Ctrl-A on the keyboard before hitting the delete button.
  • Again, It may take some time before browser complete the deletion

Will it delete Cron job for active plugins?

  • After another couple of minutes the cron jobs for current active plugins will re-populat the list.
  • Also hundreds from common plugins such as Wordfence, BackupBuddy, Nextgen Gallery, and AutoOptimizer – all of which we generally use and if not useful then un-install as well.
  • It should do the trick and your website now will loads like it’s been turbo-charged.

It will load the admin area much quicker. Admin timeout errors have disappeared.

What if I want it to fix via DB commands?

First log into your database and then enter

SELECT * FROM `wp_options` WHERE option_name = 'cron'

If you find it you might try:

In SQL: UPDATE wp_options SET option_value = '' WHERE option_name = 'cron'
In wordpress: update_option('cron', '');

You might need to either delete the cron option or set the value to an empty serialized array.

Using update_option would be safer as value should be a serialized empty array or an empty string. You could check in wp-includes/options.php though … but using update_option will handle it properly without worrying about the database.

Do it using WP-CLI

WordPress cron events can also be cleared from the command line, using WP-CLI

wp cron event list
wp cron event delete your_example_event

More details in the wp-cli docs.

wp option delete cron works when there are thousands of cron jobs stuffed in the options. These bad jobs comes mostly from bad plugins, doing cron the wrong way.

One more way we can do this

An even simpler solution is to call delete_option( ‘cron’ ); once in some plugin. All automatically added cron jobs will get added again on the next visit/request of your site.

As a one case (mu) plugin that only runs whenever you activate it:

<?php
/** Plugin Name: Clean Cron */
register_activation_hook( __FILE__, function()
{
delete_option( 'cron' );
} );

Want us to get back to you ?

    image
    Vina Nurina Pranata
    Vina Nurina Pranata
    2023-08-15
    Very helpful and informative, also very responsive. Can't complain at all.
    Aditya vaishnav
    Aditya vaishnav
    2023-08-09
    ImpulseByte Pvt. Ltd. the best office in the world for me! B'cuz of my IB family! #Bestplaceforwork Good service provider.
    Lokendra singh Chouhan
    Lokendra singh Chouhan
    2023-06-07
    Mati
    Mati
    2023-04-24
    I recently had the pleasure of working with Sheesh & ImpulseByte, on the modification of my e-commerce website. From the very beginning, Sheesh was incredibly attentive and took the time to understand my needs and the specific changes I was looking to make. What impressed me most about Sheesh was his ability to take my vision for the website and turn it into a reality. He has a keen eye for design and was able to make suggestions and recommendations that improved the overall functionality and user experience of the website. Throughout the entire process, Sheesh was always available to answer any questions I had and address any concerns I brought up. He was incredibly patient and worked diligently to ensure that every aspect of the website was exactly how I wanted it. The end result was a beautiful and functional website that exceeded my expectations. It was clear that Sheesh had put a lot of effort and thought into the design and development of the website, and I couldn't be happier with the final product. Overall, working with Sheesh and ImpulseByte was an excellent experience. Sheesh is a talented website developer who is incredibly responsive, attentive, and professional. I would highly recommend him and his company to anyone in need of website development or management services.
    Almeida Loureiro Tiago
    Almeida Loureiro Tiago
    2022-10-15
    Sheesh and Impulse have been a tremendous help in the development of my e-commerce project. I called on their services for maintenance, resolution and especially improvement in the fluidity of my website. Their result was superb. Sheesh is meticulous and attentive. TOP Communication and efficience with great quality. Thank you!
    JL elkorno
    JL elkorno
    2022-03-01
    I called on Sheesh and his company Impulsebyte for the maintenance of my site and the creation of an online store. He was very fast and efficient. The site is beautiful, it meets my expectations perfectly if not more. I am very happy to be able to count on him in case of need. Don't hesitate to use his services, you won't be disappointed! I RECOMMEND !!!!!!!!
    romil jain
    romil jain
    2021-11-17
    Good experience with the company. This one is a best web developing company and have good services.
    Nilesh Gehlot
    Nilesh Gehlot
    2021-11-07
    One of the best things about this company quality with lower cost best services 👍
    vijaya sharma
    vijaya sharma
    2021-11-07
    Really great n sooo fast in doing work ... Must recommendable sooo 5*****...
    Mahesh Kumar
    Mahesh Kumar
    2021-11-07
    Superb !!