wp-rocket-cache-invalidation

Invalidate WP Rocket caches via rocket_clean_* APIs after data changes.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Automates the safe invalidation of WP Rocket caches when data changes in a WordPress site, ensuring users see fresh content without manual purge work.

Core Features & Use Cases

  • Granular invalidation using WP Rocket APIs such as rocket_clean_post, rocket_clean_term, rocket_clean_user, and rocket_clean_files to refresh only affected pages.
  • Safe, feature-detected integration that guards against sites without WP Rocket or partial loads.
  • Best suited for plugin or theme integrations that modify content (posts, terms, user data) or bulk imports requiring deferred domain purges.

Quick Start

Call the WP Rocket cache invalidation API after a data change using the most granular function available, e.g., rocket_clean_post for a post or rocket_clean_domain for site-wide updates.

Frequently Asked Questions about wp-rocket-cache-invalidation

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

FAQPage Schema
How do I automatically invalidate WP Rocket cache when post or term data changes?

You can invalidate WP Rocket cache automatically by calling granular functions like rocket_clean_post or rocket_clean_term immediately after a data change to refresh only affected pages.

What is the best way to safely purge WP Rocket cache during plugin development?

The best way is using feature detection by checking for rocket_clean_* functions or the WP_ROCKET_VERSION constant before purging, which safely guards against sites lacking the plugin or partial loads.

Does this WP Rocket cache invalidation approach work on high-traffic sites?

Yes, but it includes guidance to avoid overusing heavy domain-wide purges on high-traffic sites, recommending deferred bulk invalidation when full refreshes are necessary.

How do I trigger a full domain cache purge in WP Rocket for bulk imports?

For bulk imports requiring a full domain cache purge, you defer the invalidation and use rocket_clean_domain to refresh the entire site while avoiding immediate heavy loads.

Can I hook into WP Rocket cache invalidation lifecycle for CDN purges or logging?

Yes, the solution provides lifecycle hooks during the cache invalidation process that you can attach custom logic to for triggering CDN purges or logging purge events.

Why should I use granular cache invalidation instead of purging the whole domain?

Granular cache invalidation using targeted functions like rocket_clean_user refreshes only affected pages, preventing unnecessary server load compared to heavy domain-wide purges.