I’m trying to get http://example.com/site/vendors/?u=abc to rewrite to http://example.com/site/vendors/abc but I can’t for the life of me figure out how to get the url rewrites to work.
/site/ is the root directory for my WP installation
/vendors/ is a page
assuming
u
is a custom query var, you have to first add it to the array of recognized query vars:Then add an internal rewrite rule that accepts anything appended to
vendors
and passes that as theu
query var:Make sure to flush rewrite rules once for this rule to be added, you can also do this by just visiting the
Settings > Permalinks
admin page.Then in the template, you can access the value of
u
viaget_query_var()
:I believe this is what you are looking for: