Posted on 20 January, 2010 By Kim Woodbridge 3 Comments

The WordPress Fetch Feed Function and the Feed Cache

~Feeding the boardwalk cats~ (by ~Sage~)

A couple of days ago I wrote about how to use a RSS feed with the WordPress fetch feed function.

I was excited about figuring this out because I could place the feed wherever I wanted and didn’t have to worry about using a plugin.

I set it up in the evening and bookmarked a new page that should have updated the feed the following morning. Later in the day I noticed the feed hadn’t updated with the new bookmark so I started to worry that I hadn’t set it up properly or that it wasn’t going to be a workable solution.

So, I started to search and ask how often the fetch feed function pulls in the new feeds. I could not, however, find an answer to my question. That’s because I was asking the wrong question. The WordPress feed cache is what determines how often the feed is pulled in. In my search for answers I finally found this article by WP Engineer – Feed Cache in WordPress.

The article explains that by default the feed cache checks for updates to the feed every 12 hours. This is why me feed hadn’t updated. I had added the code almost 24 hours earlier but it hadn’t been 12 hours since I added the most recent bookmark to be pulled in.

The article also lists different ways to increase how often the field is pulled. I used the following code and added it to my functions file, functions.php:

<?php
add_filter( 'wp_feed_cache_transient_lifetime',
create_function( '$a', 'return 1800;' ) ); ?>

wp_feed_cache_transient_lifetime is a hook that works with the fetch feed function and can set how often the feed is checked for updates. The number 1800 refers to seconds, so in this example it is checking every 30 minutes. It probably doesn’t need to be this often – maybe something between 30 minutes and 12 hours ;-)

As WP Engineer mentions, this hook can be used in a function or in a plugin and can also be used with conditionals so that the feed is only checked and updated when specific pages are loaded.

So, mystery solved as to why my feed wasn’t being updated and I learned a little but more about WordPress that I intended when I first started playing with the fetch feed function.

photo credit: ~Sage~


Related Posts:
  • How to Add a RSS Feed Without a Plugin Using the WordPress Fetch Feed Function
  • (Anti) Social Lists 1/10/10
  • (Anti) Social-Lists 10/18/09
  • How to Remove “Says” From WordPress 2.7 Threaded Comments
  • 5 Twitter Themes for WordPress
  • Posted In : WordPress Tips
    If you enjoyed this post, please subscribe to my RSS Feed

    Post to Twitter   Post to Delicious   Post to StumbleUpon

    3 Responses to “The WordPress Fetch Feed Function and the Feed Cache”


    • What would make your feed suddenly stop working? It has been a month now that my feed no longer works. I had changed nothing just had a reader email me that my feed didn’t work, I have tried to figure out why to no avail. It aggravated me so much I finally gave up. (plus have been super busy over the last month trying to find a new place to live I have barely even posted) but I don’t want to loose the people that are subscribed.

      Feeds seem to be the thing I have the most trouble with. It took me forever to get it to work the first time. I had tried using feedburner and it worked for awhile and quit so I got rid of it and things were going great for several months then poof! gone again.


    • Hi Julie – Did anything else change around the same time? For example, was WordPress upgraded or was a new plugin installed? Are you using the Feedburner plugin to redirect the feed?

      Also, the link for the RSS subscribe image is incorrect – it says
      http://lifedomestic.com/www.lifedomestic.com/feed/rss – that needs to be fixed.

      When I try variations such as lifedomestic.com/feed a blank RSS page comes up – this leads me to believe that it’s a plugin causing the problem. You could try deactivating all plugins and then testing.

      Unfortunately, this article is unrelated to this issue – this article is about adding a feed to your page templates like the WordPress bookmarks one I have in the footer.


    • I may come to you when I get to that project i hinted to on the last post. ;)
      Dennis Edell´s last blog ..Blog Move Is Imminent ! I’m Looking For Launch Partners…


    Leave a Comment
    You may use: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> .


    Recent Comments

      • Keith Ellertson: Oh that's all I need... You can practically live on facebook. Funny thing is I said I would never do facebook! Can't get...
      • David Rogers: Like you I was very shy as a child and would never have done anything like appear on stage. My children have recently le...
      • Rajat Garg: Hey, Very interesting article ... We built a light weight app specifically for the purpose of enabling 'Welcome Ta...
      • Timothy: selective status is a must. thank you for the post.!!!!!...
      • Ajith Edassery: Kim, My love to the little one and I am sure you are a proud mom. I have gone through this a couple of times when my so...
      • Kim Woodbridge: Hi Ryan, Thank you! And I'm really glad you are using a theme that made it so much easier to remove the word says :-...
      • Kim Woodbridge: Hi Suhasini - Thank you so much - so glad to see you here....
      • Ryan: I have no training in html or CSS, no education whatsoever but I followed your instructions closely enough and met succe...