Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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.

share|improve this question
add comment

1 Answer 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.

share|improve this answer
    
in blogspot It is refreshing on tumblr It is not refreshing –  user2128747 Mar 21 '13 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. –  Marc Dingena Mar 21 '13 at 12:31
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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