wp_feed_cache_transient_lifetime
Filters the transient lifetime of the feed cache.
Usage
add_filter( 'wp_feed_cache_transient_lifetime', 'wp_kama_feed_cache_transient_lifetime_filter', 10, 2 );
/**
* Function for `wp_feed_cache_transient_lifetime` filter-hook.
*
* @param int $lifetime Cache duration in seconds.
* @param string $name Unique identifier for the cache object.
*
* @return int
*/
function wp_kama_feed_cache_transient_lifetime_filter( $lifetime, $name ){
// filter...
return $lifetime;
}
- $lifetime(int)
- Cache duration in seconds.
Default: 43200 seconds (12 hours) - $name(string)
- Unique identifier for the cache object.
Changelog
| Since 2.8.0 | Introduced. |
Where the hook is called
wp_feed_cache_transient_lifetime
wp_feed_cache_transient_lifetime
wp-includes/class-wp-feed-cache-transient.php 71
$this->lifetime = apply_filters( 'wp_feed_cache_transient_lifetime', $lifetime, $name );
wp-includes/feed.php 836
$feed->set_cache_duration( apply_filters( 'wp_feed_cache_transient_lifetime', 12 * HOUR_IN_SECONDS, $url ) );