WPQUERY filtrata per categoria per un custom type con una custom taxonomy, nell'esempio stampo tutti i post di tipo products appartenenti alla categoria specials.
<?php
//RIF
//https://codex.wordpress.org/it:Riferimento_classi/WP_Query
//http://wordpress.stackexchange.com/questions/242716/how-to-filter-custom-post-types-by-custom-category-taxonomy
$args = array(
'post_per_page' => '-1',
'post_type' => 'products',
'tax_query' => array(
array(
'taxonomy' => 'category',
'field' => 'slug',
'terms' => 'specials'
)
)
);
?>
<ul>
<?php while ( $query->have_posts() ) : $query->the_post(); ?>
<?php echo "<li><a href=\"" . get_permalink() . "\">" . get_the_title() . "</a>"; ?>
<?php endwhile; wp_reset_query(); ?>
</ul>