WordPress.org

Ready to get started?Download WordPress

Forums

Custom query_posts stopped working (2 posts)

  1. LeaseahB
    Member
    Posted 4 years ago #

    I need to exclude several categories from the home page. In index.php, I have this code before the loop:

    <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    query_posts("array('category__not_in' => array(226,217,221,194,243,552))&paged=$paged"); ?>
    	<?php if (have_posts()) : ?>
    	<?php while (have_posts()) : the_post(); ?>

    For one test I did, the test post in category 217 was excluded on page 1, but if you went to page 2 (older entries), you could see the post. For another test, it didn't exclude the post in category 217 at all.

    This used to work until the client upgraded to 2.8.4. Any help would be greatly appreciated!!

    Thanks,
    Lisa B.

  2. stvwlf
    Member
    Posted 4 years ago #

    This syntax is simpler & accomplishes the same
    query_posts("cat=-226,-217,-221,-194,-243,-552&paged=$paged")
    see if it helps

Topic Closed

This topic has been closed to new replies.

About this Topic