Skip to main content

WP-CLI: Cache Clear

Required add-on: Core

Benecaster currently exposes one WP-CLI command: wp benecaster cache clear. It requires WP-CLI to be installed and a working WordPress installation.


wp benecaster cache clear

Clears the Benecaster feed cache. Equivalent to clicking the admin UI Clear cache buttons at Benecaster → Settings → General → Advanced, but scriptable and scope-controllable.

Subcommands

# Clear All Cached Feeds on the Site (All Shows, All Tiers).
wp benecaster cache clear

# Clear All Tier Caches for One Show.
wp benecaster cache clear --show=<id>

# Clear the Cache for One Tier on One Show.
wp benecaster cache clear --show=<id> --tier=<slug>

Flags

Flag Description
--show=<id> Scope the clear to a specific show. Pass the WordPress post ID of the Benecaster show.
--tier=<slug> Scope the clear to a specific tier slug. Requires --show.
--yes Skip the confirmation prompt. Use in scripts and CI/CD pipelines.

Output

On success, outputs the count of cache entries cleared:

Cleared 3 feed cache entries.

Or when nothing needed clearing:

No feed cache entries found to clear.

Examples

# Clear Everything — Confirm Interactively.
wp benecaster cache clear

# Clear the Cache for Show ID 42 Without Prompting.
wp benecaster cache clear --show=42 --yes

# Clear Only the "Premium" Tier on Show 42.
wp benecaster cache clear --show=42 --tier=premium --yes

When to Use

  • After a WP-CLI batch episode import that bypasses the episode editor
  • In a CI/CD deployment step to force a cache flush after content migrations
  • Debugging a stale feed when the admin UI isn’t accessible

For programmatic clearing from PHP (mu-plugins, cron jobs, webhooks), use the benecaster_clear_feed_cache action instead.

See Also