WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. newmediarts
    Member
    Posted 3 years ago #

    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.

  2. Please follow this guide to report your bug:

    http://codex.wordpress.org/Reporting_Bugs

  3. newmediarts
    Member
    Posted 3 years ago #

    Added a ticket to the bug tracker:
    http://core.trac.wordpress.org/ticket/14825

Topic Closed

This topic has been closed to new replies.

About this Topic