Creating Custom WordPress Feeds
The recent integration of the tumblog into the regular Daily Cup of Tech posts, I was provided with the opportunity to play with the customization of my WordPress based RSS feeds. While it took me a bit of effort and research, I was able to come up with some really good ways to make my RSS feeds my own.
Since I did have to put in some legwork to get this to work for me, I thought that I would document what I learned I could do and let everyone else in on some of the tricks.
I am certain that I have not discovered everything that WordPress can do with an RSS feed so please feel free to add your tricks in the comments.
The Full Feed
For a WordPress blog, the most common feed is the full feed. This is every single post in the entire blog. If your domain name was MyAwesomeDomainName.com, then your RSS feed would be either:
http://MyAwesomeDomainName.com/feed/http://MyAwesomeDomainName.com/?feed=rss
Custom Feeds
With the tumblog integration, I wanted to create specific feeds based on categories. I discovered that this was a relatively simple thing to do. In fact, you can create custom feeds based on several different criteria. All I needed to do was decide on whether I wanted to create an exclusive feed, an inclusive feed, or a multiple criteria feed.
Exclusive Feed
The exclusive feed will only show information based on individual criteria. For example, a feed that only shows posts that are written by Tim Fehlman. This custom feed would look something like this:
http://MyAwesomeDomainName.com/?feed=rss&author=1
Inclusive Feed
The inclusive feed contains everything in the blog but one criteria. An example of an inclusive feed would be every post on the blog except for posts in the Tumblog category (Why does that sound familiar?). You feed link may look like this:
http://MyAwesomeDomainName.com/?feed=rss&cat=-14
Multiple Criteria Feed
The exclusive and inclusive feeds are very easy to set up since they generally have only one criteria. It is possible to create very complex feeds to suit almost any need. For example, it is possible to create a feed that shows all feeds written on December 14th containing the keyword gift, written by Tim Fehlman in the Tech Toys category but not in the Bad Idea category. This feed might look something like this:
http://MyAwesomeDomainName.com/?feed=rss&monthnum=12&day=14&author=1&cat=27&cat=-44&s=gift
Feed Parameters
All custom feeds are created using parameters. Here is a list of parameters that I have discovered works with WordPress. I am certain that there are more that I have not discovered and I will attempt to keep this list up as more are discovered or reported to me.
- cat - category ID (e.g. 23)
- author - author ID (e.g. 14)
- year - year the post was published (e.g. 2007)
- day - day of the month the post was published (e.g. 17)
- monthnum - number of the month the post was published (e.g. 6)
- hour - hour of the day the post was published (e.g. 23)
- minute - minute of the hour the post was published (e.g. 48)
- second - second of the minute the post was published (e.g. 51)
- p - the unique post ID to display (e.g. 629)
- paged - specific page number as displayed on the main blog page (e.g. 3)
Simply add these parameters and desired values to your full RSS feed URL in the format:
parameter=value
If you want to exclude a value from your feed results, simply put a - sign in front of the value:
parameter=-value
To combine multiple criteria, concatenate them with the & symbol:
parameter1=value1¶meter2=value2
Note: In order for your RSS feed to know that you are passing parameters to it, you need to indicate this to it by using the ? symbol. Depending on which version of the full RSS feed you are using, you may have to add it at the end of the full RSS feed it is not already in the RSS feed URI. Otherwise, concatenate the extra parameters using the & symbol.
A Special Parameter
It is also possible to create search feeds. By using the s parameter, you can search for a word within a post. For example, if you wanted to generate a feed where only the word autoit appears, it may look something like this:
http://MyAwesomeDomainName.com/?feed=rss&s=autoit
Other Resources
Here are a few other useful resources that I found:
- WordPress Feeds
- Customizing RSS Feed Links for Wordpress.com and WordPress Sidebar Widgets
- Excluding Categories from RSS Feed
13 Responses to “Creating Custom WordPress Feeds”
-
Brent Says:
August 5th, 2007 at 12:28 pmTim, I can’t seem to find the answer to this wordpress feed question.
It’s easy to create a feed combining multiple categories using &cat=1,2,3,4 and so on — but I notice the feed reader will only use the first category name in the feed title (i.e. Daily Cup of Tech >> DIY) instead of listing all the categories. What I’d really like to do is be able to use a custom name for a multiple category RSS feed. Do you know of any way to do that? Thanks.
-
Good Reads: Buzz in Blogs 2007-08-09 | ShanKri-la Says:
August 9th, 2007 at 9:21 pm[…] Creating Custom WordPress Feeds - Tim at Daily Cup of TechTim shows how you can create custom feeds for your WordPress blog. Check it out to get ideas on how you can get creative with all the criteria. […]
-
wordpress poster Says:
August 22nd, 2007 at 8:03 amwordpress poster…
As you\’re looking for wordpress plugins web pages and web pages, be certain to utilize everyone of the sources at your disposal….
-
Brent Says:
September 15th, 2007 at 3:27 pmThanks
-
GROW OPEN POEMS Says:
September 27th, 2007 at 3:41 amCreating Custom WordPress Feeds | Daily Cup of Tech
-
Javier Vidal Postigo Says:
December 18th, 2007 at 6:51 pmEnlaces relacionados:Creating Custom WordPress Feeds[IMG]
-
Zoë Jessica Says:
March 18th, 2008 at 2:48 amGreat post, just what I needed, very useful for excluding the daily digest of delicious links in my blog from my lifestream feed, which already includes a feed from delicious.
-
Thomas Kalka Says:
April 25th, 2008 at 4:31 amIf you look at the code for Wordpress 2.5 (file wordpress\wp-includes\query.php), this are the possible parameters, which are not mentioned in your article:
‘m’,’subpost’,’subpost_id’,'attachment’,'attachment_id’,
‘name’,’static’,'pagename’,'page_id’, ‘w’,'category_name’,
‘tag’,'tag_id’,'author_name’,'feed’,'tb’,'comments_popup’,
‘preview’‘m’ is a date-parameter; m=2008 means year=2008; m=200801 means year=2008&monthnum=1 etc
‘feed’ sets the feed-format, possible values are “rss”, “rss2″, “rdf”, “atom”
all others ares still to be described
-
Tsudohnimh Says:
June 23rd, 2008 at 3:14 pmThank you very much for your article. It was comprehensive and crystal clear. I appreciate it.
Tsudohnimh
-
hi Says:
July 5th, 2008 at 2:21 pmHi,
how can display more than 10 feeds
-
links for 2008-07-28 | Daan Jansonius Says:
July 28th, 2008 at 10:33 am[…] Daily Cup of Tech » Creating Custom WordPress Feeds (tags: rss wordpress howto feed) […]
-
Adam Stone Says:
February 2nd, 2009 at 12:15 pmHi,
Thanks for sharing, this post about customizing wordpress feeds was really helpful. I was trying to figure out a way to get a category specific Wordpress feed to an email newsletter. Not as easy as it sounds but after a few days experimenting I finally got to the point where I had something like this: http://tcp3.com/c0po
In spirit of sharing you can read about the entire process on the my blog here: http://www.d-toolsblog.com/2009/01/how-to-write-a-software-specification-part-1-history-of-the-feature/
We are working on a Wordpress plugin that will automate a lot of these processes. Stay tuned or contact me via the above links if interested.
Thanks again,
Adam
-
edoriv Says:
April 6th, 2009 at 2:26 pmyou wouldn’t happen to know of a trick to get a feed to display future posts?

