I have a Query that is pulling the newest post from 4 different custom post types that have a given category associated with them. I am trying to figure out how I can not show the newest post if it has the category of explore even though it also has the category of outdoor-recreation.

<?php
$myquery['tax_query'] = array(
'relation' => 'OR',

  array(
    'taxonomy' => 'category',
    'category__not_in' => array('explore'),
    'field' => 'slug',  
  ),
  array(
    'taxonomy' => 'category',
    'terms' => array('outdoor-recreation'),
    'field' => 'slug',  
),
array(
    'taxonomy' => 'take_category',
    'terms' => array('outdoor-recreation'),
    'field' => 'slug',
),
 array(
    'taxonomy' => 'story_category',
    'terms' => array('outdoor-recreation'),
    'field' => 'slug',
  ),
  array(
     'taxonomy' => 'news_category',
    'terms' => array('outdoor-recreation'),
    'field' => 'slug',
   ),

 );
 $myquery['showposts'] = 1;

 query_posts($myquery);

while( $wp_query->have_posts() ) :
$wp_query->the_post();

 ?>

Read more here: Exclue posts that are in a given catigory


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: