Hooks reference

Frequently used cache, asset, CSS, monitoring, and integration hooks with safe extension rules.

2 min readPart of Performance Optimisation

Performance Optimisation exposes WordPress actions and filters for integrations that need a narrow override. The complete current set is generated from the source reference; this page highlights the contracts most often needed by a theme or companion plugin.

Cache lifecycle

HookPurpose
wppo_before_cache_clearAction before an all or single-page static-cache clear.
wppo_after_cache_clearAction after a successful clear; edge and LiteSpeed adapters may fan out here.
wppo_should_cache_requestFilter the post-safety-gate cache decision for a request.
wppo_invalidation_urlsFilter additional paths purged when a post changes.
wppo_woo_cacheableFilter a WooCommerce request after canonical exclusion checks.
wppo_woo_invalidation_urlsFilter surgical product/order/coupon purge paths.

WooCommerce safe mode, unknown query parameters, and the pre-boot drop-in remain fail-closed. A filter cannot make a known unsafe query or foreign drop-in cacheable.

Assets, CSS, and images

  • wppo_exclude_minification, wppo_exclude_defer_js, and wppo_exclude_delay_js filter asset exclusion lists.
  • wppo_inline_combined_css can return false when a CDN owns the combined stylesheet.
  • wppo_delay_js_allowed_hosts controls the bounded host allowlist for deferred external scripts.
  • wppo_used_css_safelist and wppo_css_preview_fetch_timeout tune used-CSS safety and preview behavior.
  • wppo_critical_css_strict_csp and wppo_used_css_strict_csp declare a server/edge CSP that PHP cannot detect.

Monitoring and integrations

  • wppo_database_cleanup_completed fires after aggregate or per-type cleanup.
  • wppo_purge_failed_actions and wppo_action_scheduler_cleanup_enabled bound Action Scheduler retention.
  • wppo_builder_purge_map adds a builder-update purge map.
  • wppo_llms_txt_content filters generated llms.txt or llms-full.txt content.
  • wppo_esi_allowed_html is a server-side sanitization contract for ESI fragments; do not add script-capable tags casually.

Safe integration rules

  1. Use a narrow callback and preserve the incoming type.
  2. Do not log credentials, cookies, authorization headers, or full request bodies.
  3. Keep the hook\’s priority and accepted-argument count compatible with the source contract.
  4. Test on staging, including editor preview and dynamic WooCommerce routes.

Open the generated code reference for every discovered wppo_* definition and registration. The repository\’s docs/hooks.md remains the long-form developer reference.