Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm trying to add a custom feed format to my site (basically exporting data to an Excel file) and I'm getting confused by the feed caching settings. I can't figure out how to flush the cached feeds, or to turn off feed caching altogether while I'm in development.

I've tried deleting all the _transient_feed..., _transient_timeout_feed... and _transient_rss... options, but I'm still seeing the cached feeds.

And, based on some advice in this support forum thread, I tried on a whim adding this line to my wp-config.php:

define('MAGPIE_CACHE_AGE', 0);

(Obviously I'd like some caching of feeds, but it would help in development to be able to turn off the feed caching.)

Anybody got any suggestions?


Some clarification:

Sorry, I think I wasn't clear enough in the initial question, and then I threw you all by referring to the magpie cache, which was completely on the wrong path. I was shooting blind at first.

I'm adding a feed to my site using add_feed(). The function that generates the feed is using the PHPExcel class to write an excel spreadsheet. Then I'm setting appropriate headers for download, and outputting the .xls file data.

I think my problem might actually be a browser caching issue. The urls that I'm trying to output my feeds from look this this: mysite.com/facility/ummc/?feed=master_log and the xls file that's generated is called Master_Log.xls.

Adding a cache busting string to the url request can get around the cache, i.e. requesting a feed from mysite.com/facility/ummc/?feed=master_log&now=12ag4oSduq344 ... I was just wondering if there was any way of disabling the cache altogether.

share|improve this question
    
How do you add the custom feed? –  hakre Feb 7 '11 at 23:11
    
is this of any help: wordpress.stackexchange.com/questions/5704/… ? –  edelwater Feb 7 '11 at 23:34
    
do you have WP_DEBUG on? –  Bainternet Feb 8 '11 at 1:02
1  
Are you talking about feed you are generating like domain.com/feed/something/ or feed you are retrieving with fetch_feed() ? –  Rarst Feb 8 '11 at 6:42
    
Clarified. Its a feed that I'm generating. –  goldenapples Feb 8 '11 at 17:36

3 Answers 3

up vote 1 down vote accepted

It definitely might be a caching issue. I find REDbot is excellent for quick check of how result is served and what are its caching settings.

share|improve this answer
    
Thanks for the link - that was very helpful. Found out - as I was starting to suspect - it wasn't a WordPress issue at all. Tweaking the headers I was outputting with my .xls file solved the problem. –  goldenapples Feb 9 '11 at 18:19

try

 function do_not_cache_feeds(&$feed) {
   $feed->enable_cache(false);
 }

 add_action( 'wp_feed_options', 'do_not_cache_feeds' );
share|improve this answer
    
Yep, this would kill caching on fetch_feed() so must note - never use such code in production environment, this can be crazy performance killer and I had encounter crappy plugin in the past that killed caching and pretty much destroyed site's load speed. –  Rarst Feb 8 '11 at 6:45
    
Didn't do what what I was looking for, but I think my question was just unclear. See my clarification above - I'm not trying to fetch a feed, I'm trying to generate a custom feed. –  goldenapples Feb 8 '11 at 17:45
    
Perfect, this is exactly what I was looking for. I was having problems with my feed not refreshing while I was trying to add custom post types to it... –  cmcculloh Nov 25 '11 at 17:03

If you ever need to just update a single feed RIGHT NOW, for example, to reflect changes made in site settings or a plugin, all you have to do is update any of the posts that appear in the feed.

The reason for this is that WordPress, I conjecture, when serving up a feed, checks all the posts in the feed, and if none of them have been updated since the feed was cached, it serves the cache, but if a post has been updated, it regenerates the feed and refreshes the cache.

This has been useful to me a number of times, for example, when I needed to update a feed for submission to iTunes.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.