I have a Taxonomy, “Genre”. “Genre” has a Term, “advert”. I want my taxomomy template to grab all Custom Posts attached to that term, sort them by my last_name, first_name, short_title Custom Fields, and output.
But my custom query is returning 0 posts! I would love to get another set of eyes on this. I’m missing something!
<?php
$args = array(
'tax_query' => array(
array(
'taxonomy' => 'genre',
'terms' => array( 'advert' )
)
),
'meta_query' => array(
'relation' => 'AND',
'last_name_clause' => array(
'key' => 'last_name',
'compare' => 'EXISTS',
),
'first_name_clause' => array(
'key' => 'first_name',
'compare' => 'EXISTS',
),
'short_title_clause' => array(
'key' => 'short_title',
'compare' => 'EXISTS',
),
),
'orderby' => array(
'last_name_clause' => 'ASC',
'first_name_clause' => 'ASC',
'short_title_clause' => 'ASC',
),
);
$newQuery = new WP_Query( $args );
?>
Best regards,
Mark