Home » What is WordPress Guide » WP-CLI » Managing WordPress Cron (WP-Cron) Events with WP-CLI – Nexcess

Managing WordPress Cron (WP-Cron) Events with WP-CLI – Nexcess

Using the WordPress Cron (WP-Cron) Utility, this guide will cover managing WP-Cron Events using various WordPress Command Line Interface (WP-CLI) commands.

Get fast, reliable hosting for WordPress

Power your site with the industry’s fastest, most optimized WordPress hosting

Managing WordPress Cron (WP-Cron) Events with WP-CLI


Using the WordPress Cron (WP-Cron) Utility, this guide will cover managing WP-Cron Events using various WordPress Command Line Interface (WP-CLI) commands.

Overview of Managing WordPress Cron (WP-Cron) Events with the WordPress Command Line Interface (WP-CLI)

How Do You See WordPress Cron (WP-Cron) Events in WordPress?


Once on the WordPress Dashboard, click Tools > Cron Events. You will see a list all of the WP-Cron Events occurring on your WordPress website on multiple rows. Each WP-Cron Event is shown on its own row, with each one having a Delete option available.

How is a WordPress Cron (WP-Cron) Event Triggered?


WordPress Cron (WP-Cron) works by checking, at the time every page is loaded for the site, a list of scheduled tasks to see which of them needs to be run. Any WP-Cron Event due to run will be called during that page-loading event. 

Please note that WP-Cron functionality does not run constantly as the System Cron functionality does. WP-Cron functionality is only triggered in conjunction with page-loading events.

Understanding Unix/Linux System Cron & Unix/Linux System Cron Jobs

The term “cron” refers to a system of commands that follow a schedule or run at regular intervals. For example, web servers generally use Cron (also known as System Cron) to manage server maintenance and to schedule tasks. Please be aware that these type of Cron Jobs are managed and run at the Unix/Linux operating system level, and thus are considered System Cron (Cron for short) and System Cron Jobs accordingly.

What are Cron (System Cron), Cron Jobs (System Cron Jobs) & Crontab? 


Cron is a task scheduler that lets you execute a script or command automatically on a web server at a future date. It helps you automate repetitive processes. Cron is the Cron Job scheduler on Unix/Linux operating systems. For instance, you can use Cron to send emails at regular intervals automaticallyCrontab (derived from Cron Table) is a file which contains the schedule of Cron Job entries to be run and at specified times. 

Understanding the WordPress Cron (WP-Cron) Utility


WordPress has its own WordPress Cron (WP-Cron) system and corresponding WP-Cron Events you can use to schedule tasks. This guide will show you how to manage WP-Cron Events using various WordPress Command Line Interface (WP-CLI) commands.

What is WordPress Cron (WP-Cron)?


You can schedule tasks a minute to a year in advance using the WordPress Cron Utility called WP-Cron. Here are some scheduled tasks WordPress performs using WP-Cron:

  1. Checking for WordPress core updates

  2. Checking for plugin and theme updates

  3. Cleaning up spam

  4. Publishing a scheduled post


Many WordPress plugins also rely on WP-Cron to manage scheduled tasks — such as creating automatic backups, clearing the cache, etc. Each task is a WP-Cron Event.

Using the WordPress Command Line Interface (WP-CLI)


WP-CLI is the command-line interface for WordPress that lets you update plugins, configure multisite installations, and do more using commands. You can work on your website without opening a web browser or the WP-Admin Dashboard. 


The WordPress Command Line Interface (WP-CLI) is preinstalled on all the Nexcess Managed WordPress hosting plans. You will need SSH credentials to get into the server and use WP-CLI


If you are on an operating system like Linux or Mac, you can use the built-in SSH terminal. In contrast, Windows users can use PuTTY to access the server.


You can also create and modify WordPress scheduled tasks (WP-Cron) through the Nexcess Client Portal.

Managing WordPress Cron (WP-Cron) Events with Command Line Interface (WP-CLI)


Here are the WP-Cron commands you can use to schedule new tasks or manage the scheduled tasks. 

wp cron event list


This command lists all WP-Cron Events scheduled to run on your WordPress website:


[axx67899@cloudhost-211111116 html]$ wp cron event list
+————————————+———————+———————–+————+
|
 hook                               | next_run_gmt        | next_run_relative     | recurrence |
+————————————+———————+———————–+————+
|
 wp_privacy_delete_old_export_files | 2022-02-26 20:55:11 | 42 minutes 44 seconds | 1 hour     |
|
 cache_enabler_clear_expired_cache  | 2022-02-26 20:55:19 | 42 minutes 52 seconds |

Ready to get started?

Get the fastest, most secure WordPress.org hosting on the market.

Additional resources

What is managed WordPress hosting? →

Get details and decide if managed WordPress hosting is right for you.

Must-have web development plugins to create WordPress websites at scale →

Explore the best web development plugins to enhance functionality, improve performance, and streamline your WordPress site.

A complete guide to WordPress shortcodes →

Shortcodes make life easier. Learn how to get started!