[wp-trac] [WordPress Trac] #14825: 'Sticky' Posts from excluded category still included in WP_Query results
WordPress Trac
wp-trac at lists.automattic.com
Tue Mar 1 21:54:38 UTC 2011
#14825: 'Sticky' Posts from excluded category still included in WP_Query results
------------------------------------+------------------------------
Reporter: newmediarts | Owner: ryan
Type: defect (bug) | Status: reviewing
Priority: normal | Milestone: Awaiting Review
Component: Query | Version: 3.0.1
Severity: major | Resolution:
Keywords: has-patch dev-feedback |
------------------------------------+------------------------------
Comment (by newmediarts):
Just a question:
If you wanted to try reducing this down to one query, wouldn't it be
easier to do something like the following:
Given `get_option("sticky_posts") == array(10, 12, 16)`:
{{{
SELECT * from wp_posts
WHERE wp_posts.post_type = "post"
ORDER_BY wp_posts.ID IN (10, 12, 16) DESC, # sticky_posts IDs
wp_posts.post_date DESC # regular orderby clause
}}}
instead of doing two separate SQL queries? (simplified code used above)
--
Ticket URL: <http://core.trac.wordpress.org/ticket/14825#comment:5>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list