Rewrite priority from query string to permalink
On a site with a custom post type news
and a custom taxonomy topic
, both with matching rewrite slugs, I’m trying to understand and control WordPress’s rewrite replacement priority for changing a raw query string into a permalink.
These two urls point to the same post_type archive:
/news/?topic=food
(post_type-first, preferred)/topic/food?post_type=news
(taxonomy-first)
What’s confusing, and what I’d like to enforce, is that a plain request to ?post_type=news&topic=food
gets rewritten taxonomy-first instead of the post_type-first. /news/?topic=food
should be canonical.
How can I reverse that priority so the raw query string rewrites and redirects to the post_type-first url?
Leave an answer