1

I'm currently trying to use add_rewrite_rule() to create a rewrite (duh!), for a custom taxonomy page.

I've added the rewrite tag "sort" with the following code:

add_rewrite_tag('%sort%','([^&]+)');

The issue is I'm not very familiar with the rewrite structure and I'm struggling.. I have a rewrite rule that is getting close, but still not quite working.

add_rewrite_rule('^vehicle-make/([^/]*)/?','index.php?page_id=40&sort=$matches[1]','top');

The problem is it's pulling in the wrong page; I'm needing to show the taxonomy archive for the specific term. So instead of a page ID I'm guessing I just need to pull in the taxonomy name and current term archive.

1 Answer 1

1

I found the correct url and patched the rewrite and it works perfectly now! This is what I ended with!

add_rewrite_rule('^vehicle-make/([^/]*)/([^/]*)/?','index.php?vehicle-make=$matches[1]&sort=$matches[2]','top');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.