Debugging WordPress Cron with WP CLI

Advertisement

Check Cron is supported or not Check Cron is supported or not

Tests the WP Cron spawning system and reports back its status.

This command tests the spawning system by performing the following steps:

  • Checks to see if the DISABLE_WP_CRON constant is set; errors if true
    because WP-Cron is disabled.
  • Checks to see if the ALTERNATE_WP_CRON constant is set; warns if true.
  • Attempts to spawn WP-Cron over HTTP; warns if non 200 response code is
    returned.
λ wp cron test
Success: WP-Cron spawning is working as expected.

Cron Schedules Cron Schedules

Cron schedules list Cron schedules list

λ wp cron schedule list
+-------------------------------------------+-----------------+----------+
| name                                      | display         | interval |
+-------------------------------------------+-----------------+----------+
| wp_astra_portfolio_importer_cron_interval | Every 5 Minutes | 300      |
| wp_image_process_cron_interval            | Every 5 Minutes | 300      |
| wp_astra_sites_single_page_cron_interval  | Every 5 Minutes | 300      |
| wp_astra_site_importer_cron_interval      | Every 5 Minutes | 300      |
| wp_astra_theme_db_migration_cron_interval | Every 5 Minutes | 300      |
| hourly                                    | Once Hourly     | 3600     |
| twicedaily                                | Twice Daily     | 43200    |
| daily                                     | Once Daily      | 86400    |
| every_two_days                            | Every two days  | 172800   |
| weekly                                    | Once Weekly     | 604800   |
+-------------------------------------------+-----------------+----------+

Cron Events Cron Events

List all Cron Events List all Cron Events

Syntax:

wp cron event list [--fields=<fields>] [--<field>=<value>] [--field=<field>] [--format=<format>]

Example:

λ wp cron event list
+------------------------------------+---------------------+-----------------------+------------+
| hook                               | next_run_gmt        | next_run_relative     | recurrence |
+------------------------------------+---------------------+-----------------------+------------+
| wp_privacy_delete_old_export_files | 2020-06-26 10:09:51 | 13 minutes 31 seconds | 1 hour     |
| wc_admin_process_orders_milestone  | 2020-06-26 10:36:11 | 39 minutes 51 seconds | 1 hour     |
| give_weekly_scheduled_events       | 2020-06-26 10:51:16 | 54 minutes 56 seconds | 1 week     |
| give_daily_scheduled_events        | 2020-06-26 10:51:16 | 54 minutes 56 seconds | 1 day      |
| wc_admin_unsnooze_admin_notes      | 2020-06-26 10:53:03 | 56 minutes 43 seconds | 1 hour     |
| woocommerce_cleanup_logs           | 2020-06-26 11:21:31 | 1 hour 25 minutes     | 1 day      |
| wpbackitup_daily_scheduled_events  | 2020-06-26 12:35:33 | 2 hours 39 minutes    | 1 day      |
| elementor/tracker/send_event       | 2020-06-26 13:49:29 | 3 hours 53 minutes    | 1 day      |
| wpseo-reindex-links                | 2020-06-26 14:16:01 | 4 hours 19 minutes    | 1 day      |
| woocommerce_cleanup_sessions       | 2020-06-26 14:21:31 | 4 hours 25 minutes    | 12 hours   |
| wp_version_check                   | 2020-06-26 21:09:51 | 11 hours 13 minutes   | 12 hours   |
| wp_update_plugins                  | 2020-06-26 21:09:51 | 11 hours 13 minutes   | 12 hours   |
| wp_update_themes                   | 2020-06-26 21:09:51 | 11 hours 13 minutes   | 12 hours   |
| woocommerce_scheduled_sales        | 2020-06-27 00:00:00 | 14 hours 3 minutes    | 1 day      |
| simple_history/maybe_purge_db      | 2020-06-27 07:21:12 | 21 hours 24 minutes   | 1 day      |
| wc_admin_daily                     | 2020-06-27 07:52:52 | 21 hours 56 minutes   | 1 day      |
| woocommerce_cleanup_personal_data  | 2020-06-27 08:21:41 | 22 hours 25 minutes   | 1 day      |
| woocommerce_tracker_send_event     | 2020-06-27 08:21:41 | 22 hours 25 minutes   | 1 day      |
| recovery_mode_clean_expired_keys   | 2020-06-27 09:09:50 | 23 hours 13 minutes   | 1 day      |
| wp_scheduled_delete                | 2020-06-27 09:10:19 | 23 hours 13 minutes   | 1 day      |
| delete_expired_transients          | 2020-06-27 09:10:19 | 23 hours 13 minutes   | 1 day      |
| wp_scheduled_auto_draft_delete     | 2020-06-27 09:10:21 | 23 hours 14 minutes   | 1 day      |
| wpbackitup_weekly_scheduled_events | 2020-06-29 12:35:33 | 3 days 2 hours        | 1 week     |
| wpseo_ryte_fetch                   | 2020-07-01 14:15:53 | 5 days 4 hours        | 1 week     |
| wp_site_health_scheduled_check     | 2020-07-02 09:09:50 | 5 days 23 hours       | 1 week     |
| rank_math/tracker/send_event       | 2020-07-03 00:00:00 | 6 days 14 hours       | 1 week     |
| give_monthly_scheduled_events      | 2020-07-19 10:51:16 | 3 weeks 2 days        | 1 month    |
+------------------------------------+---------------------+-----------------------+------------+

Delete Cron Event Delete Cron Event

wp cron event delete <hook>

Run Cron Event Run Cron Event

wp cron event run [<hook>...] [--due-now] [--all]

Schedule Cron Event Schedule Cron Event

wp cron event schedule <hook> [<next-run>] [<recurrence>] [--<field>=<value>]

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: