Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Other how to get custom posts for custom taxonomy ? Reply To: how to get custom posts for custom taxonomy ?

#151775
Energ
Participant

You need to use a custom WP_query. Something like this:
$args = array(
‘post_type’ => ‘post’,
‘tax_query’ => array(
‘relation’ => ‘AND’,
array(
‘taxonomy’ => ‘movie_genre’,
‘field’ => ‘slug’,
‘terms’ => array( ‘action’, ‘comedy’ )
),
array(
‘taxonomy’ => ‘actor’,
‘field’ => ‘id’,
‘terms’ => array( 103, 115, 206 ),
‘operator’ => ‘NOT IN’
)
)
);
$query = new WP_Query( $args );

You can read more here.