wp-plugin-cron

Schedule WordPress cron tasks with wp_next_scheduled guards and custom intervals.

21|1|Updated Apr 29, 2026
One-click install
npx skills add https://github.com/Lonsdale201/wp-agent-skills --skill wp-plugin-cron
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: wp-plugin-cron
Source: https://github.com/Lonsdale201/wp-agent-skills/tree/main/plugin-scaffold/wp-plugin-cron
Command: npx skills add https://github.com/Lonsdale201/wp-agent-skills --skill wp-plugin-cron

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

WordPress cron is notoriously tricky to manage: tasks can be missed, duplicated, or poorly timed, especially when activating or deactivating plugins or running large networks.

Core Features & Use Cases

  • Idempotent scheduling guards using wp_next_scheduled to prevent duplicates on reactivation.
  • Clear activation/deactivation lifecycle examples for per-site and network-wide cron.
  • Guidance on choosing between native WP cron and Action Scheduler for scalable workloads and debugging.
  • Multisite-aware scheduling best practices for per-blog cron in a WordPress network.

Quick Start

Define your first scheduled task in activation and guard it with wp_next_scheduled to prevent duplicates.

Frequently Asked Questions about wp-plugin-cron

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I prevent duplicate WordPress cron jobs when a plugin is reactivated?

To prevent duplicate WordPress cron jobs on plugin reactivation, use the wp_next_scheduled function as an idempotent scheduling guard before adding your scheduled task. This checks if an event is already queued, ensuring activation hooks do not create redundant cron entries.

What is the best way to schedule WordPress cron tasks on a multisite network?

The best way to manage WordPress multisite cron tasks is using per-site scheduling within activation and deactivation hooks. This approach ensures each blog in the network executes its cron events independently, avoiding global scheduling conflicts.

When should I use Action Scheduler instead of native WP cron for background tasks?

You should use Action Scheduler instead of native WP cron when managing scalable workloads or delayed tasks that require robust debugging. Action Scheduler provides more reliable background processing for long-running jobs than the default WP cron system.

How do I add custom intervals to WP cron schedules?

You can add custom intervals to WP cron schedules by filtering the cron_schedules array. This allows you to define specific time frequencies beyond the default WordPress intervals, enabling precise timing for your scheduled tasks.

Why are my WordPress cron jobs missing or poorly timed during plugin deactivation?

WordPress cron jobs are often missed during plugin deactivation if lifecycle hooks fail to clear scheduled events properly. Implementing clear deactivation routines ensures your cron tasks are cleanly removed, preventing orphaned or poorly timed executions.

Does wp_next_scheduled work for de-duplicating long-running WordPress cron tasks?

Yes, wp_next_scheduled works for de-duplicating WordPress cron tasks by checking existing event queues before scheduling. For long-running jobs, combining this guard with Action Scheduler ensures background work avoids overlapping or duplicated executions.