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 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">

        <?php
        $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'])) {
        $args['tax_query']=array(
                array(  
                    '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
add comment

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.