• Hi, I have a cutom post type named : art & design and i have a taxonomy called main slider, in one loop i have only posts from the taxonomy main slider and in the other loop i have the loop for the custom post type art & design but i want to exclude the taxonomy ?

    1st loop

    <?php
      	$args = array( 'artdesign_mainslider' => 'art-design-featured-post', 'posts_per_page' => 5 );
    $loop = new WP_Query( $args );
    while ( $loop->have_posts() ) : $loop->the_post();  ?>
    
    <?php endwhile; ?>

    2nd loop ( i want to exclude artdesign_mainslider)

    <?php
        $args = array( 'post_type' => 'art_design', 'posts_per_page' => 10, );
    $loop = new WP_Query( $args );
    while ( $loop->have_posts() ) : $loop->the_post();  ?>
    
    <?php endwhile; ?>
Viewing 1 replies (of 1 total)
  • One possibility: Select an array of all the IDs of posts with ‘artdesign_mainslider’ and use that as the ‘post__not_in’ parameter of the second query.

Viewing 1 replies (of 1 total)
  • The topic ‘Custom post type taxonomy exclude’ is closed to new replies.