[wp-trac] [WordPress Trac] #19198: Die fast in get_posts if in_search_post_types returns nothing

WordPress Trac wp-trac at lists.automattic.com
Mon Nov 7 20:00:19 UTC 2011


#19198: Die fast in get_posts if in_search_post_types returns nothing
-----------------------------+------------------------------
 Reporter:  mitchoyoshitaka  |       Owner:  ryan
     Type:  defect (bug)     |      Status:  reviewing
 Priority:  normal           |   Milestone:  Awaiting Review
Component:  Query            |     Version:
 Severity:  minor            |  Resolution:
 Keywords:  has-patch        |
-----------------------------+------------------------------
Changes (by mitchoyoshitaka):

 * owner:   => ryan
 * status:  new => reviewing


Comment:

 This patch incorporates two decisions:

 1. Whether to just kill the query immediately or to continue building the
 (no-row-returning) query. I believe we *should* continue to build the SQL
 query and let it run as some filter might come along and save the query,
 making it non-trivial.
 2. How to create a . My first intuition was to always add `null` to the
 list of `post_types in ()`, but then trivial cases such as `post_types in
 (null, 'post')` has the potential of being (probably only a little) slower
 than `post_types in ('post')`. The solution presented here just makes it
 `post_types in (null)` in cases when `$in_search_post_types` is empty.

 Feedback welcome.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/19198#comment:1>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list