Code Example:
Show Post where Category name ‘new’ and Tag Name: ‘special’
<?php
$paged = get_query_var( "paged" )?get_query_var( "paged" ) : 1;
$posts_per_page = -1;
$_p = new WP_Query(array(
'posts_per_page' => $posts_per_page,
'paged' => $paged,
'tax_query' => array(
'relation' => 'AND',
array(
'taxonomy' => 'category',
'field' => 'slug',
'terms' => array('new')
),
array(
'taxonomy' => 'post_tag',
'field' => 'slug',
'terms' => array('special')
)
)
));
while( $_p->have_posts() ):
$_p->the_post();
?>
//POST TITLE
<h3><a href="<?php the_permalink( ); ?>">
<?php the_title( ); ?>
</a>
</h3>
<?php
endwhile;
wp_reset_query();
?>