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 am trying to allow users to filter a custom post type list by multiple taxonomies. For Example lets say my custom post type is clothing and it has two custom taxonomies brand and type associated with it.

I would like a visitor to first see all clothing posts, then they could click on a brand link that brings them to a listing of all clothing in that brand(I can do this part). From that list of clothing in the chosen brand, I'd like them to be able to further narrow down the list to a type of clothing such as pants, so that now they are seeing a list of pants made by the brand they previously chose.

I've looked around, and I found an older post showing how to do this by creating some rewrite rules: but, I'm really hoping there's an easier way than using rewrite rules out there now.

Can anyone point me in the right direction here?

share|improve this question

1 Answer 1

up vote 0 down vote accepted

Alright well this might not be ideal, but it works and was much simpler than I thought!

I ended up just adding a $_GET parameter to the 2nd taxonomy terms' linked url, so I could get the 2nd term from the other taxonomy on the next page through $_GET.

On the next template I built a new WP_Query that uses the tax_query parameters to return posts from both taxonomy' terms, if the 2nd taxonomies term is set.

Any thoughts on a better approach are still very much welcome.


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.