Wordpress Logo

CPT – Output specific taxonomy

To show a list of custom posts from a custom taxonomy

$args = array(
    'tax_query' => array(
        array(
            'taxonomy' => 'your-custom-taxonomy',  // z. B. Filme
            'field' => 'slug',
            'terms' => array( 'your-term' )  //Unterkategorie, z. B. Drama
        ),
    ),
    'post_type' => 'your-post-type'
);
$loop = new WP_Query($args);
     if($loop->have_posts()) {
    $term = $wp_query->queried_object;
     while($loop->have_posts()) : $loop->the_post();
        //Output what you want      
   echo '<li><a href="'.get_permalink().'">'.get_the_title().'</a></li>';
      endwhile;
}

Quelle: https://wordpress.stackexchange.com/questions/66219/list-all-posts-in-custom-post-type-by-taxonomy