[wp-trac] [WordPress Trac] #14825: 'Sticky' Posts from excluded category still included in WP_Query results

WordPress Trac wp-trac at lists.automattic.com
Fri Sep 10 00:05:57 UTC 2010


#14825: 'Sticky' Posts from excluded category still included in WP_Query results
--------------------------+-------------------------------------------------
 Reporter:  newmediarts   |       Owner:                     
     Type:  defect (bug)  |      Status:  new                
 Priority:  normal        |   Milestone:  Awaiting Review    
Component:  Query         |     Version:  3.0.1              
 Severity:  major         |    Keywords:  sticky wp_query bug
--------------------------+-------------------------------------------------
 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.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/14825>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list