#18364 closed defect (bug) (fixed)
Don't compute in_search_post_types if we're not going to use it
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 3.3 | Priority: | normal |
| Severity: | trivial | Version: | |
| Component: | Performance | Keywords: | has-patch |
| Focuses: | 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)
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?