Posted on 20 January, 2010 By 5 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:

Posted In : WordPress Tips

Did you enjoy this article? I can assist you with your WordPress or Facebook project. Contact me and I will provide you with an estimate. You can also connect with me on Facebook or follow me on Twitter.






5 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… =-.


  • Hi Kim,

    I found your article after Googling: “Increase cache speed of wordpress feed” or may be a similar one (I don’t exactly remember).

    I, too, was looking to make the WP feed cache pull the feed more often. So, should I enter the code to functions.php? Is there a plug in that does this job for us?
    Matthew´s last post ..Bistro MD Coupons &amp Discount Codes


Trackbacks/Pingbacks
  1. Parse RSS in WordPress using SimplePie & fetch_feed() | kevinleary.net
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> .

CommentLuv badge

About

Kim Woodbridge is an accomplished Information and Technical Consultant specializing in the entire implementation of a WordPress based website including installation, theme design, upgrades, unique customizations and ongoing site maintenance.

Recent Comments

    • Marbella: Hi Kim, To get a Valentine card from a child who has been working with it for a few days means so much. They show their...
    • Gaynell M. Jones: Hi Kim, Wow, This is amazing! How can you read this much and blog at the same time?.. Well I'm not that a reader myse...
    • Gaynell M. Jones: Wow! This are cute! I will creat this for my darling. Thanks for the sharing this wonderful Idea....
    • Cmack: I found this website that shows how to have thumbnails link to another page by using the alt/title info in the gallery. ...
    • Lily Rose: This is so cute! I love it when people make their day and do the same for their close ones...

Wordpress Services

  • Installation, upgrades and maintenance
  • Conversion of existing html and css templates
  • Theme and plugin recommendations
  • CSS customizations
  • Troubleshooting and tweaks for unique situations
  • Customization for individual blogging goals and needs
  • Training and advice