how to get custom post type category list in loop code example

Example: custom post type loop with category

// using category slug
 $args = array(  
          'post_type' => 'produto', 
          'posts_per_page' => -1, 
          'tax_query' => array(
            array(
                'taxonomy' => 'produto_category',
                'field'    => 'slug', // term_id, slug  
                'terms'    => 'taeq',
            ),
           )
         );

// using category id
/* $args = array(  
          'post_type' => 'produto', 
          'posts_per_page' => -1, 
          'tax_query' => array(
            array(
                'taxonomy' => 'produto_category',
                'field'    => 'term_id', // term_id, slug  
                'terms'    => 5,
            ),
           )
         );

*/ 

$loop = new WP_Query($args);

Tags:

Php Example