Everything You Need to Know About WP-Cron in WordPress

If you need to know what a WordPress cron job is, this article is for you.

In this post, I will explain cron jobs in simple terms so you can understand. And show the differences compared to WordPress cron jobs.

Being responsible for a WordPress site, you already use cron jobs, even if you do not know what they are.

What is a cron job?

Cron (Command Run On) is a utility present in Unix systems and, later, in Linux distributions. The cron reads the crontab (cron tables) and runs predefined scripts at regularly scheduled intervals.

One good example of a script is scheduling a backup of your website every 24 hours.

System administrators use cron to run tasks automatically, like checking for system updates, updating databases, or cleaning old data.

What is a WordPress cron job (wp-cron)?

WordPress is a PHP application that doesn’t have access to system cron.

Still, WordPress must run different tasks to ensure your website works fine. Some examples of tasks include:

  • Checking for theme and plugin updates
  • Sending email notifications
  • Publishing scheduled posts

WP-Cron is how WordPress handles automated tasks in WordPress. It is a file (wp-cron.php) located in the root folder of your installation.

One big difference between system cron and wp-cron: while system cron runs constantly, wp-cron only runs when your website pages are loaded. In practice, wp-cron simulates a cron system job without needing server configuration.

WordPress wp-cron is less reliable than a system cron job because you must wait for someone to visit your website so wp-cron can get executed. And that can happen after a couple of minutes or several hours.

By default, we can’t see the scheduled tasks in WordPress, but we will have access to more information if we install a plugin.

View WordPress Cron System

WP Control is the plugin I recommend installing on your website. This plugin is free and has excellent ratings in the WordPress.org directory.

WP Control edit hooks

You can install it by going to Plugins > Add New in your WordPress dashboard and searching for WP Control.

After installing and activating, WP Control allows you to:

  • View all WordPress cron events
  • Edit, delete, pause, resume, and run cron events
  • Bulk delete cron events
  • Add and remove custom cron schedules
  • Export cron event lists as a CSV file

Go to Tools > Cron Events to view the plugin’s page.

WP Control events
WP Control – List of cron events

The initial page shows all scheduled cron events by their name (Hook) and the next run.

Edit cron jobs with WP Control

Reading the hook name can help us determine if that cron event is from WordPress or a third-party plugin. WordPress hooks start with wp_ prefix.

WP Control admin view
WP Control – Options available to hooks

If you move your mouse over each row, you will see new options below the hook: Edit, Run now, or Pause this hook.

We can modify hook settings by clicking on the Edit option.

WP Control Plugin
WP Control – Page to edit hooks

For example, we can change the number of times that our WordPress website checks for theme updates. Instead of Twice Daily, we can update to Once Daily. Choose that option, and click on the button Update Event.

From now on, that cron job will only run once every day.

Warning: To change cron events, you must know what you are doing. WordPress hooks don’t usually have the Delete option active, while hooks from other plugins have that option active.

Final Notes

In this post, I’ve tried to explain what is a WordPress wp-cron job and help you understand better how everything works.

Luís Frias
Luís Frias

Luís Frias is a web developer and trainer with over 25 years of experience.