WordPress.org

Ready to get started?Download WordPress

Forums

Cannot exclude category from query_posts() (2 posts)

  1. joesmalley
    Member
    Posted 3 years ago #

    A recent upgrade of WordPress has stopped some code from working on my index.php template. The code is used to hide all category 56 posts from appearing in my template's loop:

    global $query_string;
    query_posts($query_string.'&cat=-56');

    However after a recent upgrade, it shows the posts from category 56. If I remove the $query_string from the query_post argument, it works, category 56 posts aren't shown. So there's some problem with what $query_string contains.

    If I echo out $query_string it returns 'pagename=blog'.

  2. joesmalley
    Member
    Posted 3 years ago #

    I found a way around this by adding

    $query_string = remove_query_arg('pagename');

    between the two lines above. But I think there's definitely a bug here, the pagename and cat parameters aren't working together as they used to.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.