Support » Fixing WordPress » Custom Custom Post Type Taxonomy OrderBy Title

  • I’m trying to sort the results of a custom post type called ‘product’ by the custom taxonomy ‘product category’ term title and ascending.

    Here is the the query code from my taxonomy-product-category.php

    $queried_object = get_queried_object();
    $term_id = $queried_object->term_id;
    
    $args = array(
    	'orderby' => 'title',
    	'order' => 'ASC',
    	'tax_query' => array(
    		array(
    			'taxonomy' => 'product-category',
    			'field' => 'id',
    			'terms' => $term_id,
    		)
    	)
    );
    $query = new WP_Query( $args );

    however that code is not working as seen in this screen shot – http://note.io/Rm3yw5

  • The topic ‘Custom Custom Post Type Taxonomy OrderBy Title’ is closed to new replies.