I'd like to display a list of products for a certain category, sorted by the post_excerpt. The original code I used was this:
$args = array( 'tax_query' => array( array( 'taxonomy' => 'product_cat', 'field' => 'slug', 'terms' => array( 'my-product-category' ), 'operator' => 'IN' ) ), 'orderby' => 'post_excerpt', 'order' => 'ASC' ); $loop = new WP_Query( $args );
This displays the products, but the orderby is ignored in a taxonomy query. So I've changed the query to:
$args = array( 'post_type' => 'product', 'orderby' => 'post_excerpt', 'order' => 'ASC', 'product_cat' => 'My Product Category', 'post_status' => 'publish' ); $loop = new WP_Query( $args );
The products are displayed, but the orderby clause is still ignored.