Custom post type Query with a custom taxonomy

[vc_row][vc_column][vc_column_text]Firs of all don’t use query_posts() ever, read more about it here: When should you use WP_Query vs query_posts() vs get_posts()?.

You have to use WP_Query to fetch posts what you need. Read documentation for it. In your case the query could be like this:[/vc_column_text][vc_column_text]

 $args = array( 
     'posts_per_page' => -1, 
     'post_type'=>'your_post_type',
     'orderby' => 'date',
     'order' => 'ASC', 
     'tax_query' => array(
        array(
            'taxonomy' => 'your_taxonomy_name',
            'field'    => 'slug',  
            'terms'    => 'your_taxonomy_slug',
        ),
       )
 );

[/vc_column_text][/vc_column][/vc_row]

Leave a Reply

Your email address will not be published. Required fields are marked *

Name *

Available for work