0

I've seen similar questions posted before but they don't seem to quite fit my problem.

I have a post type called product and I have 2 taxonomies, product_cat and location

I want archive pages that combine both these taxonomies which would be structured like this /product/product_cat/location

I know this can be done with rewrites but I can't figure out how to make it work.

Update

I've achieved this to an extent using

  add_rewrite_rule( '^art-classes/([^/]*)/([^/]*)/?',
                 'index.php?product_cat=$matches[1]&location=$matches[2]',
                 'top' );

But now my single product page won't load. it just loads the archive page still. Something wrong with my regex?

0
0
function custom_rewrite_rules() {
 add_rewrite_rule( '^art-classes/([^/]*)/([^/]*)/?$',
                 'index.php?product_cat=$matches[1]&location=$matches[2]',
                 'top' );

}
add_action('init', 'custom_rewrite_rules');

The $ at the end did the job. Not sure why.

Your Answer

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

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