|

QT: Increase the WordPress RSS Widget Refresh Rate

Note: This article was published while I was in my early 20s. I was much younger and dumber. Please don't hold it against me. One of the perils of having a 20+ year old website!

While working on the redesign to this blog, I wanted to add the “Interesting Stuff” column you see just to the right. Using the RSS feed widget built into WordPress would be perfect, except for the fact that it only updates ever 12 hours. In today’s Quick Tip, we fix that problem.

The solution is a simple one. Just add this line of code to your theme’s function file:

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

Aha! But What does it all mean? Well let’s take it step by step.

add_filter is a WordPress function call that allows you to ‘hook’ into the WordPress core and execute a function during a certain operation. The two arguments are the hook- that is, when you want to execute a certain bit of code- and the function to execute.

In this case, our hook is wp_feed_cache_transient_lifetime. Simply put, it’s the hook that handles feed refreshes.

Finally, we have create_function('$a', 'return 600;'). This line creates a function on the fly that returns a new refresh time in seconds. I went with every 10 minutes, but use your discretion.

That’s it! Now you have a single line that allows you to control how often your feed widget refreshes.

Similar Posts

  • | |

    Hosted Platform vs. Your Own Platform: How Do You Choose?

    When I was in grammar school (or primary school, depending on where you live), we had a fenced-in slab of pavement where the students could play during recess. It was…kinda boring, but it was highly unlikely we’d get hit by a car. We were protected. There was also this HUGE, open field across the street….

  • |

    A Simple Solution to Selling Workshops

    While working out my income and project goals for this year, something I added to my list was more paid workshops and webinars. I want people to be able to sign up, get the workshop and the replay, and learn something tangible. And as a WordPress developer, it’s easy to think, “Oh I can put this whole thing on WordPress. But I’ve been actively deciding against WordPress for things like this. Here’s why.

    Get the bonus content by joining the Creator Crew

  • |

    Responsive Design with WordPress Giveaway

    As you’ve probably read, my book, Responsive Design with WordPress, came out last month and is now available to purchase online and in stores. My publisher has also sent me a few copies to give to family, friends, important people, etc. I’ve decided that I’m going to give a few of those copies away through a…

  • A Commitment to Committing

    If I can say one thing about working at Crowd Favorite, it’s that I’ve learned a lot about git and Github. From using the basic command line tools to working closely with submodules, I can say I understand git much more today than I did 3 months ago. Earlier this week, my friend Colin challenged me to 30…

  • |

    More Information on WP in One Month

    When I launched WP in One Month in November, it was admittedly a bit rushed. I set up a “preview” class (whatever that is) and promised a discount without really explaining what attendees would get out of it. I’d like to take a moment in this blog post to answer these questions: What / When…

  • |

    Announcing Responsive Design with WordPress

    If you’ve been milling around the site lately, or follow me on Facebook, Twitter, Google+, LinkedIn, or Dribbble, you’ll know I’ve been working on a book. Last week I officially launched the site for @NEPABlogCon and I’m happy today to officially announce my second book, Responsive Design with WordPress. Responsive Design with WordPress shows readers Responsive…

2 Comments

Comments are closed.