• Resolved miocene22

    (@miocene22)


    I want to exclude posts from one category from being shown on my blog page.
    I have this code that I’ve been using:

    <?php query_posts($query_string . '&cat=-4'); ?>
    /*The loop as normal*/

    This used to work but I think it stopped working when I upgraded to 3.2.

    Any ideas how to fix it?

Viewing 2 replies - 1 through 2 (of 2 total)
  • try to add <?php global $query_string; ?> before your code;

    or try:

    <?php global $wp_query;
    $args = array_merge( $wp_query->query, array( 'category__not_in' => array(4) ) );
    query_posts( $args ); ?>
    Thread Starter miocene22

    (@miocene22)

    The second suggestion worked. Thanks a lot…

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Exclude a category from the loop’ is closed to new replies.