My query needs to order the posts by a Custom Taxonomy called "markets", but the query lists the posts order by a "meta_value" called "state". These should be also sorted by "markets".
Here is the code:
$query_args = array(
'post_type' => $post_type,
'posts_per_page' => 50,
'post_status' => 'publish',
'tax_query' => array(
array(
'taxonomy' => $taxonomy,
'terms' => $type,
'field' => 'slug',
),
),
'meta_key' => 'state',
'orderby' => 'meta_value',
'order' => 'asc',
);
$query = new WP_Query( $query_args );
$post_type
is a custom post type.$taxonomy
is an custom taxonomy called "types".$type
is the type that I need to query, for example: "multimedia".For example, some results get:
California
and these should be:
California
That is order by "market"
So, this query gets the posts for a custom post type where the taxonomy is "multimedia", ordered by the states. Also I need order these results by "markets" taxonomy ASC.