Skip to content

Batch Operations

Varun Dubey edited this page Sep 13, 2026 · 2 revisions

Batch Operations

Scanning All Sites

Full Batch Scan

Scan every configured site in sequence:

wp_batch_scan()

This runs wp_full_scan() on each site and updates their status. After completion, use wp_list_sites() to see which sites are clean vs infected.

Filtered Batch Scan

Scan only sites with a specific status:

# Only scan sites not yet scanned
wp_batch_scan(status_filter="pending")

# Only re-scan previously clean sites (check for new infections)
wp_batch_scan(status_filter="clean")

Updating All Sites

Batch Update

Update WordPress core, all plugins, and all themes on every clean site:

wp_batch_update()

This only runs on sites with status "clean" - infected sites are skipped to avoid updating malware.

Workflow: Scan Then Update

The recommended daily workflow:

# 1. Scan everything
wp_batch_scan()

# 2. Review infected sites
wp_list_sites()

# 3. Clean infected sites (one by one)
wp_complete_cleanup("infected-site-1")
wp_complete_cleanup("infected-site-2")

# 4. Verify cleaned sites
wp_full_scan("infected-site-1")
wp_full_scan("infected-site-2")

# 5. Update all clean sites
wp_batch_update()

Parallel Scanning (Advanced)

For hosting companies with 50+ sites, run multiple Claude Code sessions in parallel, each handling a subset:

Terminal 1:

"Scan sites: client-a, client-b, client-c, client-d, client-e"

Terminal 2:

"Scan sites: client-f, client-g, client-h, client-i, client-j"

Each session uses the same MCP server and shared site configuration.

Exporting Site Status

Get a snapshot of all site statuses:

wp_export_sites()

This exports the full configuration (minus passwords) for backup or migration to another machine.

Clone this wiki locally