WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to exclude 2 Portfolio categories (IDs 4 & 23) from a page using the code below but it still displays all categories. Similar code works for 'Posts' but not for 'Port' - can anyone see what I'm doing wrong?

<div class="greyblock">
    <h4 class="nomar"><?php echo the_title(); ?></h4>
    <div class="sep"></div>

        <?php echo $firstCat[0]->cat_name; ?>

        <div class="clear"></div>
        <ul class="blogpost_list columns3">

        $temp = $wp_query;
        $wp_query = null;
        $wp_query = new WP_Query();
        $args = array(
        'post_type' => 'port',
        'paged' => $paged,
        'posts_per_page' => get_theme_option("portfolio_work_count"),
        'category__not_in' => array(4,23)                   

        if (isset($_GET['slug'])) {
                    'taxonomy' => 'portcat',  
                    'field' => 'slug',  
                    'terms' => $_GET['slug']  
share|improve this question
are 4 & 23 IDs of terms in your portcat taxonomy, or the default category taxonomy? category__not_in works only with the default category taxonomy, you need a NOT IN tax query for custom taxonomies. – Milo Apr 29 '13 at 15:48
So what would I need to add/remove from the above code so it doesn't show IDs 4 and 23 (which are PORTFOLIO categories)? – Sam Apr 30 '13 at 13:01

Your Answer


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

Browse other questions tagged or ask your own question.