← ClaudeAtlas

orbit-cron-auditlisted

Audit `wp_schedule_event` / `wp_schedule_single_event` calls in a WordPress plugin — check for missed schedules, duplicate registrations on every page load, missing unschedule on deactivation, hooks scheduled but never registered (zombie crons), and overlapping cron windows that cause performance regressions. Use when the user says "cron audit", "wp_schedule_event", "scheduled tasks", "WP-Cron", or has a customer report of "site slow at certain times".
adityaarsharma/orbit · ★ 1 · Testing & QA · score 55
Install: claude install-skill adityaarsharma/orbit
# 🪐 orbit-cron-audit — wp_schedule_event hygiene WP-Cron is plugin teams' favourite way to schedule background work — and where most introduce bugs (zombie crons, missing unschedule, duplicate registrations). --- ## Quick start ```bash # Static audit (read code) claude "/orbit-cron-audit Review ~/plugins/my-plugin for cron registration hygiene." # Live state (read DB) wp-env run cli wp cron event list --format=table # All plugins' cron events (find conflicts) wp-env run cli wp cron event list --format=csv | grep my_plugin ``` Output: `reports/cron-audit-<timestamp>.md`. --- ## What it checks ### 1. Schedule registered on `init` (not at file-load) ```php // ❌ Re-runs on every request if ( ! wp_next_scheduled( 'my_plugin_task' ) ) { wp_schedule_event( time(), 'hourly', 'my_plugin_task' ); } // ✅ Once on activation register_activation_hook( __FILE__, 'my_plugin_activate' ); function my_plugin_activate() { if ( ! wp_next_scheduled( 'my_plugin_task' ) ) { wp_schedule_event( time(), 'hourly', 'my_plugin_task' ); } } ``` The "if not scheduled" check still hits the DB on every page load — even idempotently. Move it to activation. ### 2. Unschedule on deactivation + uninstall ```php register_deactivation_hook( __FILE__, 'my_plugin_deactivate' ); function my_plugin_deactivate() { $timestamp = wp_next_scheduled( 'my_plugin_task' ); if ( $timestamp ) wp_unschedule_event( $timestamp, 'my_plugin_task' ); // Or, more aggressively, clear all of plugin's schedule