Remove JetPack cron jobs

Uit De Vliegende Brigade
Naar navigatie springen Naar zoeken springen
The ever reappearing JetPack cron events, here displayed through wp-crontrol

Even long after removing JetPack, new JetPack related cron jobs are added to the cron list. Removing them through wp-admin » Tools » Cron Events doesn't help. That sounds like an interesting problem.

What events?

Details:


$ wp cron event list | grep jetpack

       hook                next_run_gmt      next_run_relative   recurrence
--------------------   -------------------   -----------------   ----------
jetpack_clean_nonces   2023-12-05 07:30:31	  now	           1 hour
jetpack_v2_heartbeat   2023-12-05 07:30:31	  now	           1 day

Plugins & code snippets

None of this worked:

  • Automattic offers a plugin to fix this [1]. It can be installed through wp plugin install https://github.com/automattic/jetpack-addons/archive/add/jp-rm-options.zip → It doesn't work
  • Someone here suggests Advanced DB Cleaner PRO to clean it up → It doesn't work
  • Someone here also suggests WP Crontrol to clean it up → It doesn't work
  • Automattic has some php code. What I think the essence of it, can be executed through php01="wp_clear_scheduled_hook( 'jetpack_clean_nonces' );"; wp eval "$php01" → It doesn't work.

Added by WooCommerce?

The two entries above, only reappear if WooCommerce is active. And now for something surprising: They are related [2]:

You may already be aware that you don’t need the Jetpack plugin
to use WooPayments. However, your WordPress.com account is still
linked through Jetpack’s service using a PHP library.

Is that a problem?

Before delving into an analysis below, a key question: Is that a problem?. Actually, no: If this library fulfills a reasonably role within our WooCommerce sites, that would be fine with me.

So much WooCommerce jobs???

When WooCommerce is disabled and I remove all custom jobs (wp cron event list --fields=hook --format=csv | xargs -I % wp cron event delete), I have a nicely clean list with only 9 system jobs:

$ wp cron event list

+----------------------+------------------------+-------------------+------------+
| hook                 | next_run_gmt           | next_run_relative | recurrence |
+----------------------+------------------------+-------------------+------------+
| recovery_mode_clean_ | 2023-12-05 17:19:47    | now               | 1 day      |
| expired_keys         |                        |                   |            |
| wp_privacy_delete_ol | 2023-12-05 17:19:48    | now               | 1 hour     |
| d_export_files       |                        |                   |            |
| wp_update_plugins    | 2023-12-05 17:19:48    | now               | 12 hours   |
| wp_update_themes     | 2023-12-05 17:19:48    | now               | 12 hours   |
| wp_version_check     | 2023-12-05 17:19:48    | now               | 12 hours   |
| wp_site_health_sched | 2023-12-06 17:19:49    | 1 day             | 1 week     |
| uled_check           |                        |                   |            |
+----------------------+------------------------+-------------------+------------+

Once WooCommerce is activated, I get again a rather messy list - uncluding one job without an action.

$ wp plugin activate woocommerce

Plugin 'woocommerce' activated.
Success: Activated 1 of 1 plugins.

$ wp cron event list

+------------------------------------+---------------------+-----------------------+---------------+
| hook                               | next_run_gmt        | next_run_relative     | recurrence    |
+------------------------------------+---------------------+-----------------------+---------------+
| recovery_mode_clean_expired_keys   | 2023-12-05 17:19:47 | now                   | 1 day         |
| wp_privacy_delete_old_export_files | 2023-12-05 17:19:48 | now                   | 1 hour        |
| wp_update_plugins                  | 2023-12-05 17:19:48 | now                   | 12 hours      |
| wp_update_themes                   | 2023-12-05 17:19:48 | now                   | 12 hours      |
| wp_version_check                   | 2023-12-05 17:19:48 | now                   | 12 hours      |
| wp_update_user_counts              | 2023-12-05 17:21:26 | now                   | 12 hours      |
| action_scheduler_run_queue         | 2023-12-05 17:21:44 | now                   | 1 minute      |
| wc_admin_daily                     | 2023-12-05 17:21:45 | now                   | 1 day         |
| woocommerce_cleanup_personal_data  | 2023-12-05 17:21:55 | now                   | 1 day         |
| woocommerce_tracker_send_event     | 2023-12-05 17:21:55 | now                   | 1 day         |
| generate_category_lookup_table     | 2023-12-05 17:21:55 | now                   | Non-repeating |
| jetpack_clean_nonces               | 2023-12-05 17:22:00 | now                   | 1 hour        |
| jetpack_v2_heartbeat               | 2023-12-05 17:22:00 | now                   | 1 day         |
| wc_admin_process_orders_milestone  | 2023-12-05 17:22:00 | now                   | 1 hour        |
| woocommerce_geoip_updater          | 2023-12-05 17:22:45 | 45 seconds            | 2 weeks 1 day |
| woocommerce_cancel_unpaid_orders   | 2023-12-05 18:21:45 | 59 minutes 45 seconds | Non-repeating |
| woocommerce_cleanup_logs           | 2023-12-05 20:21:45 | 2 hours 59 minutes    | 1 day         |
| woocommerce_cleanup_rate_limits    | 2023-12-05 20:21:45 | 2 hours 59 minutes    | 1 day         |
| woocommerce_scheduled_sales        | 2023-12-05 23:00:00 | 5 hours 38 minutes    | 1 day         |
| woocommerce_cleanup_sessions       | 2023-12-05 23:21:45 | 5 hours 59 minutes    | 12 hours      |
| wp_site_health_scheduled_check     | 2023-12-06 17:19:49 | 23 hours 57 minutes   | 1 week        |
+------------------------------------+---------------------+-----------------------+---------------+

After visiting wp-cron.php all jobs seem to get executed, plus at least one new job that is now created:

$ wp cron event list

+------------------------------------+---------------------+-----------------------+---------------+
| hook                               | next_run_gmt        | next_run_relative     | recurrence    |
+------------------------------------+---------------------+-----------------------+---------------+
| wp_1_wc_privacy_cleanup_cron       | 2023-12-05 17:23:31 | now                   | 5 minutes     |
| action_scheduler_run_queue         | 2023-12-05 17:23:44 | 5 seconds             | 1 minute      |
| wp_privacy_delete_old_export_files | 2023-12-05 18:19:48 | 56 minutes 9 seconds  | 1 hour        |
| woocommerce_cancel_unpaid_orders   | 2023-12-05 18:21:45 | 58 minutes 6 seconds  | Non-repeating |
| jetpack_clean_nonces               | 2023-12-05 18:22:00 | 58 minutes 21 seconds | 1 hour        |
| wc_admin_process_orders_milestone  | 2023-12-05 18:22:00 | 58 minutes 21 seconds | 1 hour        |
| wc_admin_unsnooze_admin_notes      | 2023-12-05 18:23:29 | 59 minutes 50 seconds | 1 hour        |
| wp_version_check                   | 2023-12-05 18:23:30 | 59 minutes 51 seconds | Non-repeating |
| woocommerce_cleanup_logs           | 2023-12-05 20:21:45 | 2 hours 58 minutes    | 1 day         |
| woocommerce_cleanup_rate_limits    | 2023-12-05 20:21:45 | 2 hours 58 minutes    | 1 day         |
| woocommerce_scheduled_sales        | 2023-12-05 23:00:00 | 5 hours 36 minutes    | 1 day         |
| woocommerce_cleanup_sessions       | 2023-12-05 23:21:45 | 5 hours 58 minutes    | 12 hours      |
| wp_update_plugins                  | 2023-12-06 05:19:48 | 11 hours 56 minutes   | 12 hours      |
| wp_update_themes                   | 2023-12-06 05:19:48 | 11 hours 56 minutes   | 12 hours      |
| wp_version_check                   | 2023-12-06 05:19:48 | 11 hours 56 minutes   | 12 hours      |
| wp_update_user_counts              | 2023-12-06 05:21:26 | 11 hours 57 minutes   | 12 hours      |
| recovery_mode_clean_expired_keys   | 2023-12-06 17:19:47 | 23 hours 56 minutes   | 1 day         |
| wp_site_health_scheduled_check     | 2023-12-06 17:19:49 | 23 hours 56 minutes   | 1 week        |
| wc_admin_daily                     | 2023-12-06 17:21:45 | 23 hours 58 minutes   | 1 day         |
| woocommerce_cleanup_personal_data  | 2023-12-06 17:21:55 | 23 hours 58 minutes   | 1 day         |
| woocommerce_tracker_send_event     | 2023-12-06 17:21:55 | 23 hours 58 minutes   | 1 day         |
| jetpack_v2_heartbeat               | 2023-12-06 17:22:00 | 23 hours 58 minutes   | 1 day         |
| woocommerce_geoip_updater          | 2023-12-20 17:22:45 | 2 weeks               | 2 weeks 1 day |
+------------------------------------+---------------------+-----------------------+---------------+

See also

Sources

---