Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have a custom post type set up called projects with a custom taxonomy called categories that has a number of terms. For one of them called archive I would like to remove its associated posts from the custom post loop. I'm attempting with the code below, but doesn't seem to be excluding.

<?php $loop = new WP_Query( array( 'post_type' => 'projects', 'orderby'=>'rand', 'posts_per_page' => -1 ) ); 

query_posts( array(
'post_type' =>'projets',
'tax_query' => array( 
array( 'taxonomy' => 'categories', 'field' => 'slug', 'terms' => array( 'archive', ), 'operator' => 'NOT IN',),)
) );
?>

<?php while ( $loop->have_posts() ) : $loop->the_post(); ?> POST CONTENT <?php endwhile; ?>
share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.