Public hooks reference
This is the compact reference for POM Cache's supported WordPress extension points. The linked guides explain timing, safety, and complete examples.
The signatures below use typed reference notation to show return values and arguments; they are not copy-and-paste PHP callbacks.
Administration and request classification
pom_cache_settings
Filters the POM Framework settings definition.
array apply_filters( 'pom_cache_settings', array $settings )
Use it only to extend the public settings model. Preserve existing keys and follow POM Framework field contracts.
pom_cache_disable_cache_on_wp_die
Controls whether selecting the POM Cache wp_die handler defines DONOTCACHEPAGE.
bool apply_filters( 'pom_cache_disable_cache_on_wp_die', true )
The safe default is true.
pom_cache_tracking_parameters
Filters the list of query parameters that can be discarded as non-representational tracking data.
array apply_filters( 'pom_cache_tracking_parameters', array $parameters )
Only add a key when its value never changes page content, permissions, language, price, or behavior.
pom_cache_query_variant
Opts a specific route into separate, finite HTML query variants. The default empty policy keeps functional queries dynamic.
array apply_filters( 'pom_cache_query_variant', array $policy, array $query, string $path )
Return namespace (stable string identifying the representation/configuration), parameters (parameter names mapped to allowed string values), and a positive max_age in seconds. Optional ignore names must never change rendered content. Recognized tracking names are ignored automatically. Optional headers supports Cache-Control and X-Robots-Tag on cached reads; the owner must also emit those headers on live renders.
The owner must recognize the route, approve anonymous reuse and register the filter before init. POM Cache rejects unlisted parameters, invalid values, arrays and duplicate keys. Sorted parameter/value combinations receive separate entries, never the query-free entry. An approved policy does not bypass authentication, session, method, error or DONOTCACHEPAGE exclusions. Only complete HTTP 200 HTML is stored.
Reads use PHP at wp_loaded (phase=query), before WordPress resolves the main query. Expired files are bypassed; a successful render replaces them. This saves route resolution and rendering, but still boots WordPress. Direct Apache delivery and progressive JSON are unchanged. Clearing a single HTML URL also clears its query variants. See the integration example.
pom_cache_accept_headers
Filters the media-type fragments treated as JSON-like rather than HTML.
array apply_filters( 'pom_cache_accept_headers', array $media_types )
The defaults include application/json, application/activity+json, and application/ld+json.
HTML read and generation
pom_cache_can_serve_cached_file
Filters whether an existing HTML file can be served.
bool apply_filters(
'pom_cache_can_serve_cached_file',
bool $can_serve,
string $file,
array $context
)
Known context keys are phase, file, request_uri, request_method, has_cache_bypass_cookie, donotcachepage_defined, and is_user_logged_in. Only veto an allowed read; do not turn a rejected read into an allowed one.
pom_cache_ob_callback_filter
Filters the live rendered buffer before final eligibility checks.
string apply_filters( 'pom_cache_ob_callback_filter', string $buffer )
Its result is returned to the visitor and becomes the candidate cache content.
pom_cache_only_cache_known_pages
Controls whether an unclassified response is rejected.
mixed apply_filters( 'pom_cache_only_cache_known_pages', 1 )
Keep the truthy default unless you can prove every newly admitted response is public and complete.
pom_cache_404
Controls generation and delivery of the single shared public 404 document. WordPress must first resolve the request as a 404. Missing URLs never receive per-URL HTML files.
bool apply_filters( 'pom_cache_404', true )
pom_cache_eof_tags
Filters the regular expression used to recognize a complete response.
string apply_filters( 'pom_cache_eof_tags', string $regular_expression )
Return a valid regular expression.
pom_cache_buffer
Filters only the copy about to be stored, after the generation-time comment and before final POM Cache comments.
string apply_filters( 'pom_cache_buffer', string $cached_copy )
The current visitor receives the original rendered buffer.
HTML paths and deletion
pom_cache_cache_dir
Filters the absolute current-site HTML cache base path.
string apply_filters( 'pom_cache_cache_dir', string $absolute_path )
pom_cache_dir
Filters the host-and-request relative fragment used to build an HTML cache directory.
string apply_filters( 'pom_cache_dir', string $relative_fragment )
Changing it requires all early, WordPress, server, status, and deletion paths to agree.
pom_cache_filenames
Filters the list returned by pom_cache_get_cache_filenames().
array apply_filters( 'pom_cache_filenames', array $filenames )
The input includes index.html and any query-variant HTML files for that URL. It does not rename artifacts used by the reader and writer; preserve the supplied list when extending it.
pom_cache_protected_directories
Filters the absolute directories protected from HTML pruning.
array apply_filters( 'pom_cache_protected_directories', array $directories )
pom_cache_should_delete_site_cache
Shared high-level gate for site-wide or edited-single HTML deletion and JSON site deletion.
bool apply_filters(
'pom_cache_should_delete_site_cache',
true,
string $context
)
pom_cache_delete_site_cache_flush_rewrite_rules
Controls the soft rewrite-rule flush after HTML deletion.
bool apply_filters(
'pom_cache_delete_site_cache_flush_rewrite_rules',
bool $should_flush,
string $context
)
The default is true for manual and manual_ajax, false for other contexts.
pom_cache_clear_post_cache
Vetoes automatic HTML clearing for a viewable post.
bool apply_filters( 'pom_cache_clear_post_cache', true, WP_Post $post )
pom_cache_cleared
Runs after the low-level current/blog HTML cache clear.
do_action( 'pom_cache_cleared' )
It has no arguments.
Progressive JSON
Runtime, directory, and read filters
bool apply_filters( 'pom_cache_json_enabled', bool $enabled, array $context )
string apply_filters( 'pom_cache_json_cache_dir', string $path, int $blog_id )
bool apply_filters(
'pom_cache_json_can_serve_cached_file',
true,
string $file,
array $context
)
The pom_cache_json_enabled context is currently empty. Treat it as extensible.
Write filter and actions
bool apply_filters(
'pom_cache_json_should_write',
true,
string $relative_path,
string $json,
array $context
)
do_action( 'pom_cache_json_before_write', string $file, string $json, array $context )
do_action( 'pom_cache_json_after_write', string $file, string $json, array $context )
Purge actions and gates
do_action( 'pom_cache_json_before_purge', array $args )
do_action( 'pom_cache_json_after_purge', array $args, int $deleted )
bool apply_filters(
'pom_cache_json_should_delete_site_cache',
true,
string $context
)
bool apply_filters( 'pom_cache_json_clear_post_cache', true, WP_Post $post )
Optional settings-change integration
bool apply_filters( 'pom_cache_json_purge_on_settings_changes', false )
array apply_filters(
'pom_cache_json_framework_settings_purge_pages',
array $page_slugs,
string $page_slug,
string $tab,
string $subsection
)
When enabled, the default watched POM Framework pages are pom-theme-options and pom-translate; faceted-search settings saves also purge JSON.
POM Theme progressive archive contract
POM Cache consumes these public POM Theme hooks:
mixed apply_filters(
'pom_progressive_archive_cached_json',
mixed $cached_json,
string $relative_path,
array $context
)
do_action(
'pom_progressive_archive_json_generated',
string $relative_path,
string $json,
mixed $response,
array $context
)
POM Cache reads only when $cached_json is null and writes generated data only when the context contains a truthy cacheable value.
See the topic-specific articles for supported helper functions and safe usage.
Exact HTML invalidation and publication guards
pom_cache_delete_html_urls(array $urls): bool: invalidate only exact single-page HTML files. See post invalidation.pom_cache_html_purge_hosts(array $hosts): array: extend the current-site host allowlist for exact HTML invalidation.pom_cache_publish_html(bool $allowed, string $filename, string $html): bool: veto final HTML publication while preserving previous vetoes.pom_cache_html_publish_finished(string $filename, bool $published): release resources acquired by the publication guard. See output buffer filters.