Site icon Hip-Hop Website Design and Development

Advanced WP_Query (two put up sorts and a number of operators)

I want to show two completely different put up sorts in the identical question… nothing unusual up to now. However I want to declare what taxonomies embrace and what exclude for each put up sorts, so, as an example, I want to show posts from the class “16” however that don’t belong to “19” as effectively, and portfolio gadgets from taxonomy “32” that don’t belong to “34” on the identical time.

I assumed that is the appropriate method:

$args = array(
    'post_status' => 'publish',
    'posts_per_page' => -1,
    'orderby' => 'date',
    'tax_query' => array(
        'relation' => 'OR',
        array(
            'relation' => 'AND',
            array(
                'taxonomy' => 'class',
                'discipline'    => 'term_id',
                'phrases'    => array( 16 ),
                'operator' => 'IN'
            ),
            array(
                'taxonomy' => 'class',
                'discipline'    => 'term_id',
                'phrases'    => array( 19 ),
                'operator' => 'NOT IN'
            ),
        ),
        array(
            'relation' => 'AND',
            array(
                'taxonomy' => 'portfolio_category',
                'discipline'    => 'term_id',
                'phrases'    => array( 32 ),
                'operator' => 'IN'
            ),
            array(
                'taxonomy' => 'portfolio_category',
                'discipline'    => 'term_id',
                'phrases'    => array( 34 ),
                'operator' => 'NOT IN'
            ),
        ),
    ),
);

but it surely does not work. Any clue on this?