Quick Tip: Getting Feeds With More Than One Tag

VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)

Sample RSS Feed Screenshot

In most normal circumstances, when you want to pull a feed from your WordPress site, you’re simply looking to pull one of the following:

  • The main feed (all posts) – http://www.example.edu/feed/
  • A specific category – http://www.example.edu/category/your-category/feed/
  • A specific tag – http://www.example.edu/tag/your-tag/feed/
  • A specific term in a custom taxonomy – http://www.example.edu/your-taxonomy/your-term/feed/

A Category and a Tag

However, there are some circumstances where you might be looking to pull a feed for posts that have a specific category & are tagged with a specific tag. At UMW, as part of our faculty profiles, we are displaying posts about each faculty member in their individual profiles. To do so, we are pulling a feed from our internal newsletter of posts within the “Professional Notes” category that are tagged with the faculty member’s username. To do that, we did a little bit of “jiggery-pokery” to pull a feed of tagged posts within a category. That feed address looks something like:

http://www.example.edu/category/your-category/feed/?tag=your-tag

A Category and Two Tags

Recently, though, we decided that we wanted to curate the stories that show up in their profiles a little more carefully. We added a “bio” tag to each of those posts, and needed to adjust the profile code so that it only pulled posts in the “Professional Notes” category that have been tagged with both the faculty member’s username and the tag “bio”.

Thankfully, WordPress makes it pretty simple to pull posts that have been tagged with two separate tags. You simply need to “concatenate” those tags in your URL query by adding a “+” symbol between them. The adjusted URL now looks like:

http://www.example.edu/category/your-category/feed/?tag=your-tag+bio

In our case, the URL for, for instance, Stephen Farnsworth, looks like http://eagleeye.umw.edu/category/professional-notes/feed/?tag=bio+sfarnswo.

You can see the difference between that usage and the original usage, which was just pulling the “sfarnswo” tag, by looking at the current feed of his username¬†without requiring the “bio” tag.

VN:F [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)

Leave a Reply