#18364 closed defect (bug) (fixed)
Don't compute in_search_post_types if we're not going to use it
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Priority: | normal | Milestone: | 3.3 |
| Component: | Performance | Version: | |
| Severity: | trivial | Keywords: | has-patch |
| Cc: |
Description
In WP_Query::get_posts(), we call get_post_types( array('exclude_from_search' => false) ) which we store as $in_search_post_types, but we only actually use it if ( 'any' == $post_type ). The result is not used anywhere else. We should move this into the conditional.
Attachments (1)
Change History (9)
mitchoyoshitaka — 22 months ago
- Keywords has-patch added
- Owner set to ryan
- Resolution set to fixed
- Status changed from new to closed
In [19078]:
mitcho, your comment sounds like it is worthy of a new ticket.
comment:6
in reply to:
↑ 5
mitchoyoshitaka — 19 months ago
Note: See
TracTickets for help on using
tickets.

Wait, just noticed that this logic here might in fact have a flaw: if there are no post types which have exclude_from_search = false, then magically *all* post types will be checked? Am I reading this right? In that case, shouldn't we just immediately return no results?
Obviously, this wouldn't be an issue except in a very customized setup where all post types have exclude_from_search = true, but still... thoughts anyone?