apply_filters( 'wp_feed_cache_transient_lifetime', int $lifetime, string $filename )

Filters the transient lifetime of the feed cache.


Parameters

$lifetime

(int) Cache duration in seconds. Default is 43200 seconds (12 hours).

$filename

(string) Unique identifier for the cache object.


Top ↑

Source

File: wp-includes/class-wp-feed-cache-transient.php

View on Trac



Top ↑

Changelog

Changelog
Version Description
2.8.0 Introduced.

Top ↑

User Contributed Notes

  1. Skip to note 1 content
    Contributed by Steven Lin

    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.