Sometimes cronjobs are scheduled when a plugin is activated, and that time is not always the preferred time, especially when you’re running a daily event.
Using WP-CLI to list cron events
wp cron event list
Output
+------------------------------------+---------------------+-----------------------+------------+
| hook | next_run_gmt | next_run_relative | recurrence |
+------------------------------------+---------------------+-----------------------+------------+
| wp_privacy_delete_old_export_files | 2022-03-15 15:38:49 | 33 minutes 18 seconds | 1 hour |
| wp_https_detection | 2022-03-15 15:38:49 | 33 minutes 18 seconds | 12 hours |
| wp_version_check | 2022-03-15 15:38:49 | 33 minutes 18 seconds | 12 hours |
| wp_update_plugins | 2022-03-15 15:38:49 | 33 minutes 18 seconds | 12 hours |
| wp_update_themes | 2022-03-15 15:38:49 | 33 minutes 18 seconds | 12 hours |
| recovery_mode_clean_expired_keys | 2022-03-15 15:38:49 | 33 minutes 18 seconds | 1 day |
| wp_scheduled_delete | 2022-03-15 15:38:51 | 33 minutes 20 seconds | 1 day |
| delete_expired_transients | 2022-03-15 15:38:51 | 33 minutes 20 seconds | 1 day |
| wp_scheduled_auto_draft_delete | 2022-03-15 15:38:53 | 33 minutes 22 seconds | 1 day |
| wolkloos_check_weather | 2022-03-15 20:19:29 | 5 hours 13 minutes | 1 day |
| wp_site_health_scheduled_check | 2022-03-21 15:38:49 | 6 days | 1 week |
+------------------------------------+---------------------+-----------------------+------------+
It’s the wolkloos_check_weather event I was looking for.
Unschedule the event
wp cron event unschedule wolkloos_check_weather
Reschedule the event with your own time
wp cron event schedule wolkloos_check_weather 06:00 daily
Output after reschedule
+------------------------------------+---------------------+----------------------+------------+
| hook | next_run_gmt | next_run_relative | recurrence |
+------------------------------------+---------------------+----------------------+------------+
| wp_privacy_delete_old_export_files | 2022-03-15 15:38:49 | 35 minutes 1 second | 1 hour |
| wp_https_detection | 2022-03-15 15:38:49 | 35 minutes 1 second | 12 hours |
| wp_version_check | 2022-03-15 15:38:49 | 35 minutes 1 second | 12 hours |
| wp_update_plugins | 2022-03-15 15:38:49 | 35 minutes 1 second | 12 hours |
| wp_update_themes | 2022-03-15 15:38:49 | 35 minutes 1 second | 12 hours |
| recovery_mode_clean_expired_keys | 2022-03-15 15:38:49 | 35 minutes 1 second | 1 day |
| wp_scheduled_delete | 2022-03-15 15:38:51 | 35 minutes 3 seconds | 1 day |
| delete_expired_transients | 2022-03-15 15:38:51 | 35 minutes 3 seconds | 1 day |
| wp_scheduled_auto_draft_delete | 2022-03-15 15:38:53 | 35 minutes 5 seconds | 1 day |
| wolkloos_check_weather | 2022-03-16 06:00:00 | 14 hours 56 minutes | 1 day |
| wp_site_health_scheduled_check | 2022-03-21 15:38:49 | 6 days | 1 week |
+------------------------------------+---------------------+----------------------+------------+
Find more information on how WP-CLI and cron schedules work here:
https://developer.wordpress.org/cli/commands/cron/event/
How to run all cron events in WordPress via WP-CLI?
Run wp cron event run --due-now
How to run a specific cron event in WordPress via WP-CLI, regardless of it’s schedule?
Run wp cron event run your_cron_event
Leave a Reply