WordPress cron job

Having issues with your WordPress website? Something not working as it should? WordPress and a lot of plugins depend on WordPress cron job, so that should be your first suspect. 

This article will tell you all you need to know about WordPress cron jobs and how to troubleshoot them.  

Let’s dive straight in, starting with the fundamental question:

What is a WordPress cron job?

A cron job, also known as cron or crontab, is a function from the Linux and Unix world. A cron job is a repetitive or scheduled task that executes a script or program frequently. It has a very powerful scheduler with lots of frequencies to set. For example, you can prepare a job for every minute, twice an hour, on a specific day(s) of the month, or similar. A cron job usually runs on the server-side. WordPress comes with a unique solution to run cron jobs that do not need to be set on the server-side.

Why use WordPress cron jobs?

WordPress is a CMS system, and many functions/tasks need to be run on a scheduled basis. You can make a post and prepare it to go online at a specific time . The core WordPress installation has many other tasks to run regularly. Plugins depend on cron jobs as well. 

For example, the WP Spotlight plugin fetches Instagram posts and places them on the website every hour by default. You can change this frequency in the plugin settings. The plugin itself creates a cron job.

Why do I need to know about WordPress cron jobs?

Let’s take the example of Instagram posts. If no new posts appear on your website, the most likely reason could be that the cron job is not working. Understanding the basics of WordPress cron job helps to identify the problem.

How does the WordPress cron job work?

The WordPress core installation includes a PHP script called wp-cron.php. Whenever someone visits your website or accesses the dashboard, the script is triggered and all the cron jobs are executed. For most websites, this is fine. But if your website has very few visitors , the cron jobs will run very infrequently. For websites with heavy traffic, cron jobs get triggered a lot and might cause performance issues resulting in a website slowdown. 

How can I control WordPress cron jobs?

To avoid performance issues you can disable the cron jobs in WordPress and configure it on the server-side. To do that you need to login to your hosting portal and configure the cron jobs. Evey good hosting company has a how-to article on this. Click here to see the how-to for Namehero. Namehero uses the Cpanel dashboard. CPanel is relatively standard, so this article should apply to most websites.

How do I confirm my WordPress cron jobs are working?

Unfortunately, this is not possible in the standard WordPress. You will need to install a plugin. I recommend WP Control (screenshot). After installation, under tools, cron events, you can see all the cron jobs. The column “next run” gives you an indication about the health. There should be no jobs with a date in the past visible. If there are any, it means cron jobs are not working and you need to look into it. 

WordPress cron job

How do I check it?

First of all, go to your hosting dashboard and check in the file manager if the file wp-cron.php is there. 

WordPress cron jobs
NameHero – CPanel

Second open/edit the wp-config.php file in the file manager.

Check for the statement.

define('DISABLE_WP_CRON', true);

If present in the wp-config.php, it means WordPress cron jobs are disabled. Change “true” to “false” or delete the statement to enable WordPress cron jobs.  

define('DISABLE_WP_CRON', true);

In fact, this the statement you would need to insert in wp-config.php if you prefer to run cron jobs server-side.

If both steps above are looking fine (wp-cron.php present, cron job not disabled in wp-config.php), then a plugin will most likely conflict with the cron jobs. 

Do you have a cache or security plugin installed? If yes, disable first the cache plugin and then check again under tools, cron events. There is a refresh button, and you will notice immediately if the last run column updates. If not, continue and disable the security plugin if installed.

Once you have identified which plugin is the culprit, the best thing to do is to delete it and any related settings and making sure they are removed from the database. You can then reinstall the plugin and start fresh.

Did this article help you resolve your problem? Please visit my Facebook page and get in touch with me. 


How to keep attackers away from your WordPress. Read my blog secure WordPress

Please let me know if this article was helpful and use the comment section below. Thank you!

Check out my blog page

What's hot on Amazon

  • Apple-designed M1 chip for a giant leap in CPU, GPU, and machine learning performance
  • 8-core CPU packs up to 3x faster performance to fly through workflows quicker than ever*
  • 8-core GPU with up to 6x faster graphics for graphics-intensive apps and games*
  • 16-core Neural Engine for advanced machine learning
  • 8GB of unified memory so everything you do is fast and fluid

Visit my accounting website

Leave a Reply

2 × 3 =