Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
[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
You can’t perform that action at this time.