0

I use RSS widget I put the address of the RSS on RSS widget: http://mysite.tumblr.com/rss I add the code to functions.php

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

It does not refresh All 100 seconds.

1 Answer 1

1

WordPress natively only refreshes RSS Feeds every 12 hours. It caches the results for this periode, so if you attempt to retrieve new RSS information, it's likely WordPress will see if its cache hasn't expired yet. Also, see the API Reference for more information.

The API Reference can be a little unclear about the use of this filter. To override the interval in which WordPress refreshes its feed cache, put this code in your functions.php file. The code below will set the interval to 100 seconds.

add_filter('wp_feed_cache_transient_lifetime', 'my_rss_interval');
function my_rss_interval( $seconds ) {
    return 100;
}

On a side note, I'm not sure what good it will do to set the interval so low. I don't know what you are trying to achieve with this, but there are performance reasons why the feed is cached. Perhaps if you explained what you are trying to achieve doing this, there is a better solution than hammering another site's feed.

2
  • in blogspot It is refreshing on tumblr It is not refreshing Commented Mar 21, 2013 at 11:08
  • 1
    The code I provided sets the interval at which the receiving end updates its cache. It's quite possible that the source also uses a cache for its feed. This means that even if new posts have appeared on the external site, the feed in which these posts appear has not updated yet. Commented Mar 21, 2013 at 12:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.