How to restrict Wordpress RSS feeds
January 7, 2012 12:45 PM   Subscribe

Question about Wordpress: how to restrict its RSS feed to one post type, using Feedburner or another method?

I'd like the RSS feed restricted so that only a certain post type, "Editorial," shows up in the feed, but not regular Loop posts.

I'm using a friendly plugin, Tentblogger Feedburner, that redirects the feed to Feedburner. But I just realized I might have created the RSS equivalent of a time paradox.

Feedburner retrieves the feed from...

http://website.com/feed/?post_type=newscomment

...and then, in turn, a plugin redirects the feed to Feedburner. But I think this might actually hinder Feedburner from retrieving new posts because Feedburner looks for the feed, only to find itself. I think?

Any ideas on the best way to make this work? Earlier I tried messing with filter hooks but had no luck.
posted by steinsaltz to Technology (4 answers total) 1 user marked this as a favorite
 
I don't know about post types, but categories get their own feeds, e.g. http://yoursite.com/category/actual-category-name/feed

So if you're able to create .htaccess files and do redirects, this might work:
RedirectMatch 301 ^/feed http://yoursite.com/category/actual-category-name/feed
posted by Monsieur Caution at 1:07 PM on January 7, 2012


Response by poster: Interesting. With a ^/feed$ to prevent an infinite loop, of course.
posted by steinsaltz at 1:52 PM on January 7, 2012


The ^ ought to prevent the infinite loop by itself by requiring /feed to be at the beginning of the path part of the request, rather than matching /feed at the end, but if you want to be thorough, ^/feed/*$ should handle both ways that the main feed can be addressed and nothing else.

I don't recall, though, how well this will interact with WordPress's own .htaccess rules. If you have control over your virtual host definition in Apache, no problem, but otherwise you may have to dork around with it a bit in the .htaccess file or perhaps turn it into a rewrite rule, e.g.

RewriteEngine On
RewriteRule ^/feed/*$ http://yoursite.com/category/actual-category-name/feed [R=301]
posted by Monsieur Caution at 2:03 PM on January 7, 2012


WordPress Feeds lists the various feeds that come "out of the box" from WordPress. It also shows you that there are at least 2 ways to get to each feed (e.g. http://example.com/post-name/feed/ and http://example.com/?feed=rss2). The main thing you want to do is change the default feed to the "editorial" category. Is it also important to disable all the other feeds? It's possible you'll need to do more hackery to disable all the other feeds.

I personally use Feedburner Feedsmith for my FeedBurner-powered feeds. Works well, and yes, it does seem like it would incude a paradox, but it works fine. More on using Feedburner here.
posted by artlung at 8:31 AM on January 8, 2012


« Older Why do I keep comparing myself to my long-ago ex...   |   beachball in january no good Newer »
This thread is closed to new comments.