Recent

crp_cache_timefilter

crp_cache_time

Filters the expiration of every CRP Cache key before its value is set.

Unlike crp_cache_time_{$key} this fires for all keys, which are md5 hashes of the query arguments and so cannot be hooked individually ahead of time. It runs first, so a per-key filter still has the last word.

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

Parameters

Type Name Description
int $cache_time Time until expiration in seconds. Use 0 for no expiration.
int $post_id Post ID.
string $key CRP Cache key name.
array $args Query arguments used to resolve a query-specific cache lifetime.

Usage

add_filter( 'crp_cache_time', function($cache_time, $post_id, $key, $args) {
    // ...
    return $cache_time;
} );