wp-background-processing

wp-background-processing is a skill for Claude Code, Codex from mralaminahamed/wp-dev-skills. It costs 316 tokens per session (3,002 once invoked), scanned A, original, MIT.

A guide for running long or repeated WordPress plugin tasks in the background instead of making visitors wait for one web request. It covers Action Scheduler, WP Background Process, and WP-Cron, which are different ways to queue or schedule work.

In plain words
What is it for?
Use it to choose and implement a queue for imports, batch processing, asynchronous API calls, recurring tasks, or dependable scheduled work in a WordPress plugin.
Why use it?
It helps avoid timeouts and unreliable scheduling when processing large batches, sending email, or calling external services.

Skill for Claude CodeCodex

Part of the wp-dev-skills plugin — 19 skills, 1 command shipped together

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/mralaminahamed/wp-dev-skills/wp-background-processing
Any agent
npx skills add mralaminahamed/wp-dev-skills --skill wp-background-processing
Clone the repo
git clone --depth 1 https://github.com/mralaminahamed/wp-dev-skills

Made for: Claude Code, Codex.

Or install wp-dev-skills, the plugin that ships this one along with the rest of its 19 skills, 1 command.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for wp-background-processing

README.md
[![agentmods](https://agentmods.dev/badge/skills/mralaminahamed/wp-dev-skills/wp-background-processing.svg)](https://agentmods.dev/skills/mralaminahamed/wp-dev-skills/wp-background-processing)
Your own site
<a href="https://agentmods.dev/skills/mralaminahamed/wp-dev-skills/wp-background-processing"><img src="https://agentmods.dev/badge/skills/mralaminahamed/wp-dev-skills/wp-background-processing.svg" alt="Measured on agentmods" height="20"></a>
Per session 316 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,002 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00316 $0.03002
Opus 5 $0.00158 $0.01501
Sonnet 5 $0.00063 $0.00600
Haiku 4.5 $0.00032 $0.00300

Measured 5d ago against content hash 738ac107296b, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

wp-background-processing scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

*/5 * * * * wget -q -O - https://example.com/wp-cron.php?doing_wp_cron >/dev/null 2>&1
skills/wp-background-processing/SKILL.md · 305 lines

How it starts

The opening of the file, as written. The whole thing — 305 lines — stays where its author put it; the contents beside it link to each section on GitHub.

WordPress Background Processing

Model note: Scaffolding a new Action Scheduler or WP_Background_Process implementation is pattern-matching — haiku handles it well. Debugging a stuck queue or race condition across async jobs requires reasoning; use sonnet.

Implement background jobs and queued tasks in WordPress plugins. Three primary tools with distinct trade-offs: Action Scheduler (persistent, battle-tested), WP_Background_Process (lightweight, no DB table), WP Cron (built-in, unreliable timing).

When to use

  • "Process a large batch of items in the background", "queue a long-running task".
  • "Set up Action Scheduler", "use WooCommerce queue".
  • "Implement WP_Background_Process", "chunked batch import".
  • "Background email sending", "async API calls".
  • "Fix a WP Cron job not firing", "make scheduled tasks reliable".
  • "The scheduled action completes but nothing happens", "the handler only runs in the admin".

Not for: One-off scheduled events (use wp_schedule_single_event). REST API async patterns — use wp-rest-api.

Method

1. Choose the right tool

Tool Persistent Retry Progress Requires Best for
Action Scheduler ✅ DB table ✅ Configurable Via hooks AS or WC Reliable multi-step queues
WP_Background_Process ✅ Options API ❌ Manual Via option ~5KB class Simple batches, no WC dep
WP Cron ❌ (transient) Nothing Maintenance, low-priority tasks

Rule of thumb: WooCommerce already installed → Action Scheduler. Simple background batch → WP_Background_Process. Periodic cleanup task → WP Cron.

2. Action Scheduler

Bundled with WooCommerce. Can also be installed as a standalone library.

Standalone install:

composer require woocommerce/action-scheduler
require_once plugin_dir_path( __FILE__ ) . 'vendor/woocommerce/action-scheduler/action-scheduler.php';

Schedule and handle actions:

// Schedule a single action (fires once ASAP)
as_enqueue_async_action( 'my_plugin_process_item', [ 'item_id' => 123 ], 'my-plugin' );

// Schedule a recurring action
as_schedule_recurring_action( time(), HOUR_IN_SECONDS, 'my_plugin_hourly_sync', [], 'my-plugin' );

// Schedule a single action in the future
as_schedule_single_action( time() + 300, 'my_plugin_delayed_job', [ 'batch' => 1 ], 'my-plugin' );

// Handle the action
add_action( 'my_plugin_process_item', function( $item_id ) {
    $result = my_plugin_do_work( $item_id );
    if ( is_wp_error( $result ) ) {
        // AS will retry on exception; throw to trigger retry
        throw new \Exception( $result->get_error_message() );
    }
} );

Read the full file on GitHub · 305 lines

Files

What ships with it

4 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 5d ago First seen · 305 lines · 316 tokens per session scan A 738ac107296b

Subscribe to this mod's changes

wp-background-processing is a skill published in the GitHub repository mralaminahamed/wp-dev-skills (27 stars, last pushed 1mo ago), licensed MIT. It adds 316 tokens to every session and 3,002 once invoked, about $0.0016 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories