
By default, the “Other WordPress News” widget in your WordPress Dashboard only updates twice a day (every twelve hours). Personally, I like to get updates quicker than that. I check my Dashboard several times a day to see if there’s some new post that I should know about. So I set mine up to update every two hours. Frequently enough to keep me more up-to-date, but not so frequently that it might be annoying to the Planet WordPress server.
If you’d like to do the same, add this code snippet to your theme’s functions.php file, or add a plugin header to it and install as a regular plugin:
-
add_filter( 'wp_feed_cache_transient_lifetime', 'dc_reschedule_rss_fetch', 10, 2 );
-
-
function dc_reschedule_rss_fetch( $lifetime, $url ) {
-
if ( false !== strpos( $url, 'planet.wordpress.org' ) ) {
-
$lifetime = 7200; // expire after 2 hours (7200 seconds)
-
}
-
return $lifetime;
-
}
This will set the cache lifetime for the Planet WordPress feed data to be two hours instead of twelve.
If you use this tip, I also recommend increasing the number of feed items displayed, as suggested in my Customize Your WordPress Dashboard article!
You appear to have a typo in your code. Shouldn’t the add_filter line read like this (e.g. remove that extra closing parentheses):
add_filter( 'wp_feed_cache_transient_lifetime', 'dc_reschedule_rss_fetch', 10, 2 );Yes, thank you for pointing it out. I’ve corrected the code.
I cut-and-pasted from a terminal window, and it cut the end of that line off. When I manually “fixed” it, I introduced the extra close-paren by accident.
Pingback: Tweets that mention Quick Tip: Faster WordPress News -- Topsy.com
Pingback: Tweets that mention Quick Tip: Faster WordPress News -- Topsy.com
Pingback: WordPress?????
Pingback: Weekend Roundup #84
Hello,
These lines made a big bug on my blog. Two hours after, the content don’t display for some of my posts. Only the content are not visible anymore.
Sehr guter Artikel. Übrigens ist Dein Blog immer einen Besuch wert. Ich komme gern wieder hier vorbei.
Hello,
These lines made a big bug on my blog
Wow every two hours? Once a day would be enough for me
Thanks for the code. I will make use of it right now.
Thanks for the info. I am switching to wordpress soon and have been searching for information so I can get it properly setup. This will help with keeping things up to date. Thanks.
This is such a good discussion. I’m sure lots of readers are enjoying this.