Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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(
            '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.

share|improve this question
when you print out the $loop, this [orderby] => post_excerpt doesn't show up? –  peteroak Aug 8 '12 at 14:34

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.