• I need to remove a category from my main posts page and I used query posts:

    <?php
    if ( is_home() ) {
    	query_posts( 'cat=-6' );
    }
    ?>

    Since there are some posts in that category that I want to include, I added another category and assigned those posts to the secondary category. However, the posts still didn’t show. Is there something else i need to do to query_posts to include those posts? Is there a better way to do this?

Viewing 1 replies (of 1 total)
  • An easy fix would be to put all categories you want in the query and just exclude the cat you do’t want to show. Something like
    query_posts( ‘cat=1,2,4,5’ );
    Will exclude category 3 but include post that have category 3 and 4 assigned.

    You could automate that with get_categories() which has it’s own exclude parameter.

Viewing 1 replies (of 1 total)
  • The topic ‘Removing Categories with query_posts’ is closed to new replies.