WordPress.org

Support

Support » How-To and Troubleshooting » Custom query_posts stopped working

Custom query_posts stopped working

  • LeaseahB
    Participant

    @leaseahb

    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.

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

Viewing 1 replies (of 1 total)
  • The topic ‘Custom query_posts stopped working’ is closed to new replies.