|

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

  • |

    How to Improve Audio Recordings at Home

    Recording audio at home can be tough, especially if you don’t have the environment. On top of that, what app do you use to record, and how can you prevent that “robot voice” that happens if you’re recording online with other people. Let’s take a look at a few helpful techniques.

  • |

    My One Month Learning Plan

    I have a confession to make. Lately I’ve felt like my skills have been slipping, or at least stagnating. Part of it is because I’ve been so busy, but part of it is because of feeble excuses like, “I’ve been so busy.” This year I’ve resolved to do a whole bunch of things, including learn more….

  • Writing a User log-in

    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!Here is the user login code I have been promising. It’s an image so it looks nice. You can download it…

  • Building Parsec: Speaking at WordCamp Lancaster

    This Saturday (February 28th) I will be speaking at the 2nd Annual WordCamp Lancaster. I had an absolute blast last year, so I’m really looking forward to this one. It’s being held at Intermediate Unit 13 and there are still some tickets left, so if you can come I strongly recommend it!

  • Types of classes, part 2

    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!Today I will continue my series on classes in Java. To review where we are, you can read this post. First…

  • |

    Quick Tip: Get a Family Cell Phone Plan to Save Money

    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!I was talking to a friend yesterday who told me his parents booted him and his brother off their family plan…

2 Comments

Comments are closed.