[WordPress] A strategy for how to retrieve custom post types tagged with multiple taxonomies.
<?php | |
$args = array( | |
'post_type' => 'acme_post_type', | |
'tax_query' => array( | |
'relation' => 'AND', | |
array( | |
'taxonomy' => 'acme_labels' | |
'field' => 'term_id', | |
'terms' => 100 | |
), | |
array( | |
'taxonomy' => 'acme_labels', | |
'field' => 'term_id', | |
'terms' => 200 | |
) | |
) | |
); | |
$posts = get_posts( $args ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment