wp-rocket-cache-rejection-and-filters

Configure WP Rocket caching behavior via rocket_* filters from plugins or themes.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Empowers developers to customize WP Rocket caching behavior from third-party code, enabling precise control over which requests are cached and how assets are served.

Core Features & Use Cases

  • Exclude URIs from caching using rocket_cache_reject_uri with path patterns.
  • Gate caching via cookies and user agents to support per-visitor experiences.
  • Manage CDN rewrites and asset handling with rocket_cdn_cnames and related filters.
  • Tune lazy-loading, ATF, and asset URL rewriting to accommodate complex sites.
  • Use feature-detection and prioritized filters to safely extend WP Rocket without breaking sites.

Quick Start

Create a small companion plugin that registers a few rocket_* filters after WP Rocket loads to customize caching for your site.

Frequently Asked Questions about wp-rocket-cache-rejection-and-filters

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

FAQPage Schema
How do I exclude specific URIs from WP Rocket caching using filters?

To exclude URIs from WP Rocket caching, apply the rocket_cache_reject_uri filter with path patterns in a companion plugin. This prevents specific page requests from being cached while keeping the rest of the site fully cached.

Can I disable WP Rocket caching for specific cookies or user agents?

Yes, you can gate WP Rocket caching for cookies and user agents using the rocket_cache_reject_cookies filter. This allows per-visitor experiences by ensuring requests with specific cookies or user agents bypass the cache entirely.

How do I rewrite CDN URLs for WordPress assets with WP Rocket filters?

You rewrite CDN URLs by applying the rocket_cdn_cnames filter to manage asset handling. This allows you to define CDN CNAMEs and fine-tune how asset URLs are rewritten across your WordPress site.

What is the safest way to customize WP Rocket lazy-load and asset handling?

The safest way to customize lazy-load and asset handling is using feature-detection and prioritized rocket_* filters. This approach safely extends WP Rocket functionality without breaking site compatibility during activation.

When should I exclude REST API endpoints from WP Rocket caching?

You should exclude REST API endpoints from WP Rocket caching when handling dynamic or per-visitor data that must bypass the cache. Applying targeted cache rejection filters ensures REST responses remain uncached and accurate.