Skip to main content
Post Made Community Wiki by Mayeenul Islam
changed so and learned. :)
Source Link
Mayeenul Islam
  • 12.9k
  • 21
  • 85
  • 169

WordPress supports external feeds, and parse the feed using a function named fetch_feed() from SimplePie. RSS widget is one of them using the same function to fetch external feed.

The Codex says:

fetch_feed caches results for 12 hours by default.

So, the feed you are fetching is actually at least 12 hours old. But a good news is there also that, you can modify the duration of the fetching by using a filter: wp_feed_cache_transient_lifetime.

How to use that? Simple. Just paste the following code into your theme's functions.php:

function feed_cache_durationadd_filter( $seconds'wp_feed_cache_transient_lifetime', function() {
     return 1800;
}
add_filter( 'wp_feed_cache_transient_lifetime', 'feed_cache_duration') });

Here,
we are using the filter to modify the duration. Here we are passing our new duration with 1800 [seconds]. The calculation is: 30 minutes = 30 min. x 60 sec. = 1800 sec.

Using the simple code you can change the duration.

Source:

WordPress supports external feeds, and parse the feed using a function named fetch_feed() from SimplePie. RSS widget is one of them using the same function to fetch external feed.

The Codex says:

fetch_feed caches results for 12 hours by default.

So, the feed you are fetching is actually at least 12 hours old. But a good news is there also that, you can modify the duration of the fetching by using a filter: wp_feed_cache_transient_lifetime.

How to use that? Simple. Just paste the following code into your theme's functions.php:

function feed_cache_duration( $seconds ) {
     return 1800;
}
add_filter( 'wp_feed_cache_transient_lifetime', 'feed_cache_duration') );

Here,
we are using the filter to modify the duration. Here we are passing our new duration with 1800 [seconds]. The calculation is: 30 minutes = 30 min. x 60 sec. = 1800 sec.

Using the simple code you can change the duration.

Source:

WordPress supports external feeds, and parse the feed using a function named fetch_feed() from SimplePie. RSS widget is one of them using the same function to fetch external feed.

The Codex says:

fetch_feed caches results for 12 hours by default.

So, the feed you are fetching is actually at least 12 hours old. But a good news is there also that, you can modify the duration of the fetching by using a filter: wp_feed_cache_transient_lifetime.

How to use that? Simple. Just paste the following code into your theme's functions.php:

add_filter( 'wp_feed_cache_transient_lifetime', function(){ return 1800; });

Here,
we are using the filter to modify the duration. Here we are passing our new duration with 1800 [seconds]. The calculation is: 30 minutes = 30 min. x 60 sec. = 1800 sec.

Using the simple code you can change the duration.

Source:

lambda as per toscho's suggestion + thanks toscho
Source Link
Mayeenul Islam
  • 12.9k
  • 21
  • 85
  • 169

WordPress supports external feeds, and parse the feed using a function named fetch_feed() from SimplePie. RSS widget is one of them using the same function to fetch external feed.

The Codex says:

fetch_feed caches results for 12 hours by default.

So, the feed you are fetching is actually at least 12 hours old. But a good news is there also that, you can modify the duration of the fetching by using a filter: wp_feed_cache_transient_lifetime.

How to use that? Simple. Just paste the following code into your theme's functions.php:

add_filterfunction feed_cache_duration( 'wp_feed_cache_transient_lifetime',$seconds create_function) {
     return 1800;
}
add_filter('$a', 'return'wp_feed_cache_transient_lifetime', 1800;''feed_cache_duration') );

Here,
we are using the filter to modify the duration. Here we are passing our new duration with 1800 [seconds]. The calculation is: 30 minutes = 30 min. x 60 sec. = 1800 sec.

Using the simple code you can change the duration.

Source:

WordPress supports external feeds, and parse the feed using a function named fetch_feed() from SimplePie. RSS widget is one of them using the same function to fetch external feed.

The Codex says:

fetch_feed caches results for 12 hours by default.

So, the feed you are fetching is actually at least 12 hours old. But a good news is there also that, you can modify the duration of the fetching by using a filter: wp_feed_cache_transient_lifetime.

How to use that? Simple. Just paste the following code into your theme's functions.php:

add_filter( 'wp_feed_cache_transient_lifetime', create_function('$a', 'return 1800;') );

Here,
we are using the filter to modify the duration. Here we are passing our new duration with 1800 [seconds]. The calculation is: 30 minutes = 30 min. x 60 sec. = 1800 sec.

Using the simple code you can change the duration.

Source:

WordPress supports external feeds, and parse the feed using a function named fetch_feed() from SimplePie. RSS widget is one of them using the same function to fetch external feed.

The Codex says:

fetch_feed caches results for 12 hours by default.

So, the feed you are fetching is actually at least 12 hours old. But a good news is there also that, you can modify the duration of the fetching by using a filter: wp_feed_cache_transient_lifetime.

How to use that? Simple. Just paste the following code into your theme's functions.php:

function feed_cache_duration( $seconds ) {
     return 1800;
}
add_filter( 'wp_feed_cache_transient_lifetime', 'feed_cache_duration') );

Here,
we are using the filter to modify the duration. Here we are passing our new duration with 1800 [seconds]. The calculation is: 30 minutes = 30 min. x 60 sec. = 1800 sec.

Using the simple code you can change the duration.

Source:

Source Link
Mayeenul Islam
  • 12.9k
  • 21
  • 85
  • 169

WordPress supports external feeds, and parse the feed using a function named fetch_feed() from SimplePie. RSS widget is one of them using the same function to fetch external feed.

The Codex says:

fetch_feed caches results for 12 hours by default.

So, the feed you are fetching is actually at least 12 hours old. But a good news is there also that, you can modify the duration of the fetching by using a filter: wp_feed_cache_transient_lifetime.

How to use that? Simple. Just paste the following code into your theme's functions.php:

add_filter( 'wp_feed_cache_transient_lifetime', create_function('$a', 'return 1800;') );

Here,
we are using the filter to modify the duration. Here we are passing our new duration with 1800 [seconds]. The calculation is: 30 minutes = 30 min. x 60 sec. = 1800 sec.

Using the simple code you can change the duration.

Source: