Title: wp_feed_cache_transient_lifetime
Published: April 25, 2014
Last modified: May 20, 2026

---

# apply_filters( ‘wp_feed_cache_transient_lifetime’, int $lifetime, string $name )

## In this article

 * [Parameters](https://developer.wordpress.org/reference/hooks/wp_feed_cache_transient_lifetime/?output_format=md#parameters)
 * [Source](https://developer.wordpress.org/reference/hooks/wp_feed_cache_transient_lifetime/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/hooks/wp_feed_cache_transient_lifetime/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/hooks/wp_feed_cache_transient_lifetime/?output_format=md#changelog)
 * [User Contributed Notes](https://developer.wordpress.org/reference/hooks/wp_feed_cache_transient_lifetime/?output_format=md#user-contributed-notes)

[ Back to top](https://developer.wordpress.org/reference/hooks/wp_feed_cache_transient_lifetime/?output_format=md#wp--skip-link--target)

Filters the transient lifetime of the feed cache.

## 󠀁[Parameters](https://developer.wordpress.org/reference/hooks/wp_feed_cache_transient_lifetime/?output_format=md#parameters)󠁿

 `$lifetime`int

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

`$name`string

Unique identifier for the cache object.

## 󠀁[Source](https://developer.wordpress.org/reference/hooks/wp_feed_cache_transient_lifetime/?output_format=md#source)󠁿

    ```php
    $this->lifetime = apply_filters( 'wp_feed_cache_transient_lifetime', $lifetime, $name );
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/class-wp-feed-cache-transient.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.0/src/wp-includes/class-wp-feed-cache-transient.php#L71)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/class-wp-feed-cache-transient.php#L71-L71)

## 󠀁[Related](https://developer.wordpress.org/reference/hooks/wp_feed_cache_transient_lifetime/?output_format=md#related)󠁿

| Used by | Description | 
| [WP_Feed_Cache_Transient::__construct()](https://developer.wordpress.org/reference/classes/wp_feed_cache_transient/__construct/)`wp-includes/class-wp-feed-cache-transient.php` |

Creates a new (transient) cache object.

  | 
| [fetch_feed()](https://developer.wordpress.org/reference/functions/fetch_feed/)`wp-includes/feed.php` |

Builds SimplePie object based on RSS or Atom feed from URL.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/hooks/wp_feed_cache_transient_lifetime/?output_format=md#changelog)󠁿

| Version | Description | 
| [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. |

## 󠀁[User Contributed Notes](https://developer.wordpress.org/reference/hooks/wp_feed_cache_transient_lifetime/?output_format=md#user-contributed-notes)󠁿

 1.  [Skip to note 2 content](https://developer.wordpress.org/reference/hooks/wp_feed_cache_transient_lifetime/?output_format=md#comment-content-4818)
 2.   [Steven Lin](https://profiles.wordpress.org/stevenlinx/)  [  5 years ago  ](https://developer.wordpress.org/reference/hooks/wp_feed_cache_transient_lifetime/#comment-4818)
 3. [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fwp_feed_cache_transient_lifetime%2F%23comment-4818)
    Vote results for this note: 0[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fwp_feed_cache_transient_lifetime%2F%23comment-4818)
 4. Example Migrated from Codex:
 5.     ```php
        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;
        }
        ```
    
 6.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fwp_feed_cache_transient_lifetime%2F%3Freplytocom%3D4818%23feedback-editor-4818)

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fwp_feed_cache_transient_lifetime%2F)
before being able to contribute a note or feedback.