# Refresh External RSS Feeds More Often

> Changes how long WordPress caches feeds fetched from other sites for the RSS widget and feed shortcodes, which is 12 hours by default.

- Type: PHP
- Runs: Run everywhere
- Category: [RSS Feeds](https://wpide.com/library/category/rss/)
- Tags: rss, cache, widgets
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/external-feed-cache-lifetime/

## Code

```php
// Cache time for external feeds, in seconds.
$wpide_feed_cache_seconds = HOUR_IN_SECONDS;

add_filter( 'wp_feed_cache_transient_lifetime', function () use ( $wpide_feed_cache_seconds ) {
    return max( 600, (int) $wpide_feed_cache_seconds );
} );
```

## Notes

Very short times add load to your server and to the source site; one hour is a sensible minimum.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Refresh External RSS Feeds More Often" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
