1

I'm facing a (hopefully) small issue right now I can't seem to solve.

First of all my page is set up in a way that all my projects (custom post type) are displayed on one big page with a query var filter containing my custom taxonomies.

So the URL with all the projects is example.com/projects/ and the filter turns the URL into this example.com/projects/?TAXONOMY=XYZ.

What I have done is list the custom taxonomies and their values on the single-projects.php page and all I'm trying to do is to rewrite the taxonomy links to lead directly to the project query and not to the taxonomy archive.

Another example, because I can't properly put my problem into words. Right now the taxonomy link leads to this: example.com/projects/TAXONOMY/XYZ/ but I want the link to be example.com/projects/?TAXONOMY=XYZ.

I have tried using the rewrite function while registering my custom taxonomy
'rewrite' => array( 'slug' => 'projects/?TAXONOMY=' )
but this returns the following URL:
example.com/projects/?TAXONOMY=/xyz/ which turns into example.com/projects/?TAXONOMY=%2Fxyz%2F once the page is loaded.

This already works and displays the right posts but it looks incredibly ugly.
Is there a way to make the taxonomy link look like this example.com/projects/?TAXONOMY=XYZ and not like this example.com/projects/?TAXONOMY=/xyz/ ?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.