Get terms for array of posts
-
Greetings all, I am using WordPress posts to create a huge collection of vendor pages, and these pages are tagged with 2 different taxonomies: location and service. The taxonomies are working wonderfully by themselves, however, I now need the ability to cross-reference them. In other words, if someone clicks the listing for Alabama, I want a list of service tags that can narrow down that listing further.
My question is: If there a way to create an array of only the terms that are attached to the the posts in the current “query_posts()” set? In this example, I don’t want to list every service tag again (there are hundreds), I only want those that are pertinent to the current “Alabama” set.
For example, if I have the following posts:
Alabama Post 1: tagged with Kitchen, Garage
Alabama Post 2: tagged with Kitchen, Bedroom
Alabama Post 3: tagged with Office, Closet…I am looking to create a term array that only contains:
Kitchen, Garage, Bedroom, Office, Closet
I feel this solution is just barely eluding me and would appreciate your input. Thanks!
- The topic ‘Get terms for array of posts’ is closed to new replies.