Rewriting Woocommerce Product Filters To URL Segments


I’m working with a site where product category pages are filtered using query parameters:


I’d like to use URL segments instead and rewrite the request to the above, for example:


The thing is, there are 10 or so of these filters and they’re only applied when they’re used. So the URL could be:


So a simple regex solution wouldn’t work, to my knowledge as the indexes aren’t always the same. The order of the keys and values will be the same, but some could be missing.

Are WordPress rewrites the right way to go about this, or do I need to look at hooking into Woocommerce’s queries?


, , Daniel Dewhurst 4 years 2019-11-04T09:43:56-05:00 0 Answers 93 views 0

Leave an answer