Inicio - Documentación - POM Cache - 09 Developers - Public hooks reference

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_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 whether a completed 404 HTML response may be written.

bool apply_filters( 'pom_cache_404', false )

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( 'index.html' ) )

It does not rename the canonical index.html artifact used by the current reader and writer.

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.