Support » Requests and Feedback » [Bug] 'Sticky' Posts from excluded category still included in WP_Query results

  • newmediarts

    (@newmediarts)


    Hi,

    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.

    Thanks.

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Bug] 'Sticky' Posts from excluded category still included in WP_Query results’ is closed to new replies.