Recent

crp_clear_related_cache_on_savefilter

Filters whether saving a post clears the cache of the posts it is related to.

Returning false leaves those posts serving their cached related posts until the cache expires, so a newly published post will not appear in their lists until then. Use this on very large sites, on a site that caches nothing, or around a migration that does not define WP_IMPORTING.

Type: filter
Since: 4.5.0
Source: includes/util/class-cache.php line 312

Parameters

Type Name Description
bool $clear Whether to clear the related posts’ cache. Default true.
int $post_id Post ID being saved.
\WP_Post $post Post object being saved.

Usage

add_filter( 'crp_clear_related_cache_on_save', function($clear, $post_id, $post) {
    // ...
    return $clear;
} );