apply_filters( ‘wp_feed_cache_transient_lifetime’, int $lifetime, string $filename )

Filters the transient lifetime of the feed cache.

Parameters

$lifetimeint
Cache duration in seconds. Default is 43200 seconds (12 hours).
$filenamestring
Unique identifier for the cache object.

Source

$this->lifetime = apply_filters( 'wp_feed_cache_transient_lifetime', $lifetime, $filename );

Changelog

VersionDescription
2.8.0Introduced.

User Contributed Notes

  1. Skip to note 2 content

    Example Migrated from Codex:

    add_filter( 'wp_feed_cache_transient_lifetime' , 'return_7200' );
    
    $feed = fetch_feed( $feed_url );
    
    remove_filter( 'wp_feed_cache_transient_lifetime' , 'return_7200' );
    
    function return_7200( $seconds ) {
       // change the default feed cache recreation period to 2 hours
       return 7200;
    }

You must log in before being able to contribute a note or feedback.