[Bug] 'Sticky' Posts from excluded category still included in WP_Query results (3 posts)

  1. newmediarts
    Posted 5 years ago #


    I want to have a list of articles that exclude posts in a category I have called "Stories." Some articles in the Stories category are marked as "sticky".

    $cat_id = get_cat_id("Stories");
    $query = new WP_Query("cat=-{$cat_id}&posts_per_page=10&caller_get_posts=0");

    However, this still returns articles from the Stories category, but only those that are marked as "sticky".

    I've taken a look at the source code of wp-includes/query.php, and it seems that what's happening is that it prepends all "sticky" posts that were not in the initial query results, regardless of category. (There is only logic implemented that honours the "post_type".)

    I would appreciate it this bug be addressed and released in an upcoming WordPress release.


  2. James Huff
    Support Team Rep.
    Posted 5 years ago #

    Please follow this guide to report your bug:


  3. newmediarts
    Posted 5 years ago #

    Added a ticket to the bug tracker:

Topic Closed

This topic has been closed to new replies.

About this Topic