Yesterday I've added AskUbuntu RSS Feed to TechyTalk.info sidebar to display feed of Ubuntu related questions with links to answers all provided by the Ubuntu community. This is really useful service. I've used WordPress RSS widget to display this RSS feed. The problem I've ran into was that WordPress RSS widget feed was refreshing only once in every 12 hours and for my purpose this is not often enough. In this article I will show you how to change WordPress RSS widget refresh interval.
To do this we will define filter using add_filter WordPress function. We will use "wp_feed_cache_transient_lifetime hook" to execute our PHP function created on the fly using create_function. This function will return time in seconds that will be our new RSS Widget refresh interval. Here is the PHP code to change WordPress RSS Widget refresh interval to 20 minutes (we will add this code at the end of our themes functions.php file):
add_filter('wp_feed_cache_transient_lifetime',create_function('$a', 'return 1200;'));
That's it, your WordPress RSS widget will refresh at the interval you have specified inside your themes functions.php file.