Query post type by specials taxonomy slug
$the_query = new WP_Query( array(
'post_type' => 'Adverts',
'tax_query' => array(
'taxonomy' => 'advert_tag',
'field' => 'slug',
'terms' => 'politics',
),
) );
while ( $the_query->have_posts() ) :
$the_query->the_post();
// Show Posts ...
endwhile;
/* Restore original Post Data
* NB: Because we are using new WP_Query we aren't stomping on the
* original $wp_query and it does not need to be reset.
*/
wp_reset_postdata();
Query post type by specials taxonomy id
$query = new WP_Query( array(
'post_type' => 'faqs', // name of post type.
'tax_query' => array(
array(
'taxonomy' => 'faq_category', // taxonomy name
'field' => 'term_id', // term_id, slug or name
'terms' => 48, // term id, term slug or term name
)
)
) );
while ( $query->have_posts() ) : $query->the_post();
// do stuff here....
endwhile;
/**
* reset the orignal query
* we should use this to reset wp_query
*/
wp_reset_query();