Dougal Campbell's geek ramblings

WordPress, web development, and world domination.

Quick Tip: Faster WordPress News

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:

// Customize the Planet WordPress news feed update time:
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!

About Dougal Campbell

Dougal is a web developer, and a "Developer Emeritus" for the WordPress platform. When he's not coding PHP, Perl, CSS, JavaScript, or whatnot, he spends time with his wife, three children, a dog, and a cat in their Atlanta area home.
This entry was posted in WordPress and tagged , , , , , , , , , , . Bookmark the permalink.

21 Responses to Quick Tip: Faster WordPress News

  1. Pingback: Tweets that mention Quick Tip: Faster WordPress News -- Topsy.com

  2. Pingback: Tweets that mention Quick Tip: Faster WordPress News -- Topsy.com

  3. Pingback: WordPress?????

  4. Pingback: Weekend Roundup #84

Leave a Reply

%d bloggers like this: