Nexcess Logo

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

Knowledge Base Home

Notice anything different?

We've enhanced the appearance of our portal and we're working on updating screenshots. Things might look different, but the functionality remains the same.
April 26, 2022

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 | 1 hour     |
 rediscache_discard_metrics         | 2022-02-26 21:08:03 | 55 minutes 36 seconds | 1 hour     |
 nexcess_mapps_daily_maintenance    | 2022-02-27 02:32:19 | 6 hours 19 minutes    | 1 day      |
 pm_request_lighthouse_reports      | 2022-02-27 07:30:14 | 11 hours 17 minutes   | 1 day      |
 wp_https_detection                 | 2022-02-27 07:55:11 | 11 hours 42 minutes   | 12 hours   |
 wp_version_check                   | 2022-02-27 07:55:11 | 11 hours 42 minutes   | 12 hours   |
 wp_update_plugins                  | 2022-02-27 07:55:11 | 11 hours 42 minutes   | 12 hours   |
 wp_update_themes                   | 2022-02-27 07:55:11 | 11 hours 42 minutes   | 12 hours   |
 nexcess_mapps_weekly_maintenance   | 2022-02-27 12:44:19 | 16 hours 31 minutes   | 1 week     |
 nexcess_mapps_usage_tracking       | 2022-02-27 14:29:19 | 18 hours 16 minutes   | 1 day      |
 wp_site_health_scheduled_check     | 2022-02-27 19:55:11 | 23 hours 42 minutes   | 1 week     |
 recovery_mode_clean_expired_keys   | 2022-02-27 19:55:11 | 23 hours 42 minutes   | 1 day      |
 wp_scheduled_delete                | 2022-02-27 20:08:13 | 23 hours 55 minutes   | 1 day      |
 delete_expired_transients          | 2022-02-27 20:08:13 | 23 hours 55 minutes   | 1 day      |
 wp_scheduled_auto_draft_delete     | 2022-02-27 20:08:13 | 23 hours 55 minutes   | 1 day      |
 elementor/tracker/send_event       | 2022-02-27 20:08:50 | 23 hours 56 minutes   | 1 day      |

Listing Scheduled WordPress Cron (WP-Cron) Events with WP-CLI in the JSON (JavaScript Object Notation) Format

To obtain a list of the scheduled WP-Cron Events in JSON, add --fields=hook,next_run --format=json after the wp cron event list command:

[axx67899@cloudhost-211111116 html]$ wp cron event list --fields=hook,next_run --format=json
"hook":"wp_privacy_delete_old_export_files","next_run":"2022-02-26 16:12:44"},{"hook":"cache_enabler_clear_expired_cache","next_run":"2022-02-26 16:12:44"},{"hook":"rediscache_discard_metrics","next_run":"2022-02-26 16:12:44"},{"hook":"updraft_backup","next_run":"2022-02-26 22:25:28"},{"hook":"updraft_backup_database","next_run":"2022-02-26 22:25:28"},{"hook":"wp_https_detection","next_run":"2022-02-27 03:12:49"},{"hook":"wp_version_check","next_run":"2022-02-27 03:12:49"},{"hook":"wp_update_plugins","next_run":"2022-02-27 03:12:49"},{"hook":"wp_update_themes","next_run":"2022-02-27 03:12:49"},{"hook":"nexcess_mapps_daily_maintenance","next_run":"2022-02-27 15:12:50"},{"hook":"elementor\/tracker\/send_event","next_run":"2022-02-27 15:12:50"},{"hook":"nexcess_mapps_weekly_maintenance","next_run":"2022-03-05 15:12:49"},{"hook":"wp_site_health_scheduled_check","next_run":"2022-03-05 15:12:50"}

If you manage a multisite, you will need to define a site URL as follows to list the scheduled tasks: 

$ wp cron event list --url=

wp cron event run

This command executes the tasks associated with the given hook. 

Running All Due WordPress Cron (WP-Cron) Events with WP-CLI 

You can use the following WP-CLI command to execute all currently due WP-Cron Events

$ wp cron event run --due-now
Executed a total of 2 cron events

Running a Scheduled WordPress (WP-Cron) Events Manually with WP-CLI 

You might have to run a WP-Cron Event manually to see if things are working correctly or to troubleshoot certain things. The following command would help you achieve this:

$ wp cron event run [<hook>...]

Here is an example of running a scheduled WP-Cron Event manually:

$ wp cron event run wp_version_check
Executed the cron event '
wp_version_check' in 0.339s.
Success: Executed a total of 1 cron event.

To run all WordPress scheduled events manually, whether they are due or not, you can use the following WP-CLI command:

$ wp cron event run --all
Executed the cron event 'wp_privacy_delete_old_export_files' in 0.006s.
Executed the cron 
event 'cache_enabler_clear_expired_cache' in 0.006s.
Executed the cron 
event 'rediscache_discard_metrics' in 0.004s.
Executed the cron 
event 'nexcess_mapps_daily_maintenance' in 0.006s.
Executed the cron 
event 'pm_request_lighthouse_reports' in 4.897s.
Executed the cron 
event 'wp_https_detection' in 0.027s.
Executed the cron 
event 'wp_version_check' in 0.069s.
Executed the cron 
event 'wp_update_plugins' in 0.005s.
Executed the cron 
event 'wp_update_themes' in 0.005s.
Executed the cron 
event 'nexcess_mapps_weekly_maintenance' in 0.004s.
Executed the cron 
event 'nexcess_mapps_usage_tracking' in 0.824s.
Executed the cron 
event 'wp_site_health_scheduled_check' in 0.286s.
Executed the cron 
event 'recovery_mode_clean_expired_keys' in 0.01s.
Executed the cron 
event 'wp_scheduled_delete' in 0.005s.
Executed the cron 
event 'delete_expired_transients' in 0.004s.
Executed the cron 
event 'wp_scheduled_auto_draft_delete' in 0.004s.
Executed the cron 
event 'elementor/tracker/send_event' in 0.005s.
Success: Executed a total of 17 cron events.

wp cron event schedule

This command lets you add your WP-Cron Events to your WordPress site. You can configure the WP-Cron event to run hourly, daily, or once a week. You can also set it up as a non-repeating event. 

As you add your WP-Cron Events, they will appear in the events list.

Scheduling a Custom WordPress (WP-Cron) Event for a Specific Date/Time with WP-CLI 

Use the following command to schedule a custom WP-Cron Event. The event will be triggered the next time the WP-Cron Utility runs:

wp cron event schedule cron_test
Success: Scheduled event with hook 'cron_test' for 2022-02-26 21:19:24 GMT.

Scheduling a Custom Cron Event for a Specific Date/Time

By adding additional parameters like the date and time, you can schedule Cron Events to run at a specific time. In the following example, a new event called “cron_test” is scheduled to run in one hour:

$ wp cron event schedule cron_test '+1 hour'
Success: Scheduled event with hook 'cron_test' for 2022-02-26 22:22:14 GMT.

Here are other examples of scheduling a task to run at different times of the day:

>> Run the Event on a Specific Date    

$ wp cron event schedule cron_test now '27 February 2022'

>> Run the Event in 1 Week

$ wp cron event schedule cron_test now '+1 week'

>> Run the Event Next Wednesday

$ wp cron event schedule cron_test now 'next Wednesday'

Schedule Recurring Cron Events

To schedule recurring WP-Cron Events, you need to add a parameter specifying how frequently the event should occur. For instance, you can set a WP-Cron Event to run hourly, daily, weekly, monthly, or even yearly.

This example uses the WP-CLI command to instruct WordPress to run ‘cron_test’ now and rerun once per day:

$ wp cron event schedule cron_test now daily
Success: Scheduled event with hook 'cron_test' for 2022-02-26 20:31:34 GMT.

The default intervals provided by WordPress are hourly, twicedaily, and daily. Check out the Code Reference at for more information.

wp cron event unschedule

This command lets you unschedule an event in WP-Cron:

$ wp cron event unschedule cron_test
Unscheduled 1 event for hook 'cron_test'.

wp cron event delete

You can also delete a scheduled event using WP-CLIRun the following command along with the action hook name to delete an existing event:

wp cron event delete <hook>

The following example shows how you can delete all scheduled WP-Cron Events for a given hook, where ‘cron_test’ is the hook here in this example:

$ wp cron event delete cron_test

Success: Deleted the cron event 'cron_test'.

WordPress Cron (WP-Cron) & Performance 

Most WordPress plugins depend on WP-Cron to schedule backups, site health checks, and cache management. Unfortunately, this can cause performance issues as all plugins try to access a single file. 

WP-Cron is often triggered as a user visits your website. So for smaller websites with low traffic, you can rely on WP-Cron without performance issues. But for larger websites, WP-Cron becomes a performance bottleneck and slows down the whole website.

You can improve your website’s performance and reliability of the website’s scheduled tasks and reduce the server load by using an optimized WP-Cron Event Schedule. In Nexcess Managed WordPress Plans, the internal WP-Cron Utility is disabled by default to avoid performance issues.

Nevertheless, if you want to enable the WP-Cron Utility, open your wp-config.php file and change the value of 'true' to 'false' in this line: 



However, we do not recommend enabling WP-Cron as it will drastically affect your site performance. If you are unsure how to handle this, please contact our support team by email or  through your Client Portal.

wp cron test

If you're experiencing issues with scheduled tasks within WordPress, your WP-Cron configuration might be to blame. Run the following command on the WordPress root directory to ensure the WP-Cron system is working properly:

$ wp cron test

If you have your internal WP-Cron disabled as is the default setting on our Nexces WordPress plans, you will see the following message:

$ wp cron test
Error: The DISABLE_WP_CRON constant is set to true. WP-Cron spawning is disabled.

If that’s not the case, you should see this result:

$ wp cron test
Success: WP-Cron spawning is working as expected.

Final Thoughts: Managing WordPress Cron (WP-Cron) Events with the WordPress Command Line Interface (WP-CLI)

Using this guide, you can schedule your tasks through WP-CLI. As a result, you can automate your recurring tasks and focus on your business instead of worrying about your website. 

Do you have any questions?

Please get in touch with our support team by email or through your Client Portal. Or you can search the Nexcess Knowledge Base for your request.

Useful Links Related to the WordPress Cron (WP-Cron) Utility

Useful Links Related to WordPress Maintenance Mode

Other Useful WordPress Links for Developers & Admins

About the Nexcess Portal

Starting with a new hosting partner can be overwhelming. For that exact reason, we have prepared a Nexcess Portal Guide to make each client’s introduction to our Nexcess Portal easier.

How to Become a Nexcess Portal Pro 

You signed up for an account with Nexcess but now what do you do? New systems can be intimidating to learn, so we’ve put together this guide to help explain what is in the portal and where to find it.

Next Steps?

Read more about the Fully Managed WordPress Hosting and its benefits for your business.

Build Better Websites with Fully Managed WordPress Hosting 

It’s hosting optimized for WordPress. That means a faster, more secure and scalable website. Smart monitoring tools are built-in to help you keep it that way. 

It’s why WordPress Users Trust Nexcess Hosting.

We also have a variety of Nexcess support articles about WordPressincluding how to get your site going with a number of different configuration options. These resources include a great article on setting this up for Migrating to Nexcess with managed WordPress and managed WooCommerce hosting

24-Hour Assistance

If you need any assistance with the above-mentioned, don't hesitate to reach out. For 24-hour assistance any day of the year, Nexcess customers can contact our support team by email or through your Client Portal.

Useful YouTube > Nexcess Channel Links

Resources for More Information

Need more help? The Applications, WooCommerceand WordPress sections within the Nexcess Knowledge Base are important resources for those seeking additional knowledge. Or, check out our related articles below.

New Customers: Fully Managed Hosting Solutions

Not a Nexcess customer yet? Check out our fully managed hosting solutions. The option to chat with an expert is also available.

Related Articles

Edith Fernandez
Edith Fernandez

Edith Fernandez works with the Managed Applications Chat Support team. As a Managed Applications Chat Support Supervisor for over 50 technicians, Fernandez leads, coaches, trains, and encourages her team. “I love taking ownership, diving deep to find areas of improvement within the department, and contributing ideas that can benefit both the team and the company,” she says.

Fernandez loves the fast pace of the tech field and the rapidity with which change occurs. Of her work accomplishments, Fernandez is most proud of her work collaborating with the Nexcess leadership team. Fernandez is happy to inspire other women, especially Indian women and girls. Caring deeply about her customers has made all the difference in Fernandez’s career.

Her advice to women interested in pursuing a career in tech is to create a vision of what they want to become. “IT is a vast field. There are so many areas and opportunities where women can excel,” she says. “There is nothing that cannot be achieved. So dream about it, work towards it, don’t be afraid to ask for help, and go after what you want.”

We use cookies to understand how you interact with our site, to personalize and streamline your experience, and to tailor advertising. By continuing to use our site, you accept our use of cookies and accept our Privacy Policy.