Site icon Hip-Hop Website Design and Development

Filter custom posts by multiple taxonomies

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); ?>