Display posts with certain Taxonomy from multiple custom post types

Question

I have 5 custom post types.
Each of these will have for example Sticky Taxonomies.
Using this code I pulled posts latest 4 posts from all custom post types. I want to add filter per taxonomies.
So latest 4 posts with Sticky Taxonomy selected.

<?php
    $latestPosts = new WP_Query(array(
        'posts_per_page' => 4,
        'post_type' => array( 'team_members', 'scientific-publicati', 'internship', 'careers-post', 'media-press-release')
    ));

    while($latestPosts->have_posts()) {
        $latestPosts->the_post(); ?>
                    <h3 class="px-3 py-2 sm:px-5 sm:py-6 text-lg md:text-xl text-blue-primary font-bold leading-tight"><?php the_title(); ?></h3>
    <?php } ?>
0
RS92 2 months 0 Answers 13 views 0

Leave an answer