Filter custom posts by multiple taxonomies

Question

Im working with custom post types – named ‘Products’

I have multiple taxonomies registered – ‘Category’ and ‘Dosage’

And I’m trying to setup pages that only display custom post types ‘products’ IF taxonomy Category=’injectors’ AND Dosage=’1ml, 2ml, 5ml’

I hope that makes sense – manage to get custom post archives working fine for a single taxonomy, but not sure about filtering by multiple.

Cheers,

This is the code i’m trying to get work but it doesn’t

<?php 
$myquery['tax_query'] = array( 
   'relation' => 'OR', 
    array( 
         'taxonomy' => 'product_category',
         'terms' => array('shrouded'),
         'field' => 'slug', 
    ), 
    array( 
        'taxonomy' => 'dosages',
        'terms' => array( '1ml' ),
        'field' => 'slug', 
   ),
);
query_posts($myquery); ?>
0
, Monk 6 years 2017-03-16T17:02:19-05:00 0 Answers 70 views 0

Leave an answer

Browse
Browse