Opened 15 years ago
Closed 15 years ago
#11072 closed defect (bug) (fixed)
Honor Post Type for Sticky Posts
Reported by: | chrisscott | Owned by: | ryan |
---|---|---|---|
Milestone: | 2.9 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Query | Keywords: | has-patch needs-testing |
Focuses: | Cc: |
Description
When specifying a post type in WP_Query, sticky posts are added to the beginning of the array regardless of the post_type if specified. The attached patch will restrict the stickies to match the post_type if specified. This is compatible with the multiple post types patch submitted in #10791.
Attachments (1)
Change History (7)
#4
@
15 years ago
This will break stickies for regular queries since the post_type is not set for them:
SELECT * FROM wp_posts WHERE wp_posts.ID IN (1611) AND wp_posts.post_type IN ('')
We'll need to set it further up or maybe use the post_type_cap.
Note: See
TracTickets for help on using
tickets.
The solution looks fine to me but I think the query should run to $wpdb->prepare first.