Adjust The RSS Widget’s Refresh Rate

Here’s another short and quick little WordPress hack for ya, it comes from Smashing Magazine and t it lets you control how often your RSS widget should refresh. As with most WordPress hacks, all it takes is adding a snippet of code in your functions.php file.


Here’s the code that you have to copy and paste:

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

The snippet uses WordPress’ add_filter() function, which accepts a filter hook, callback function and (optional) priority. The wp_feed_cache_transient_lifetime hook handles the feed’s refresh rate. The callback function is created on the fly using the create_function from PHP. The refresh rate in the above sample is 600 seconds, which is 10 minutes.

Hope some of you find this trick helpful. Cheers, everyone!

Incoming search terms for the article:

Related Posts

Turn A Photo Into A Vector Portrait With Photoshop

Correctly Embed Watermarks In Portrait And Landscape Photos Using Conditional Actions In Photoshop CS6.1

Oregon-Inspired Photoshop Tutorial

Create Google Play’s Tab Navigation Using jQuery And CSS