#18364 closed defect (bug) (fixed)
Don't compute in_search_post_types if we're not going to use it
| Reported by: | mitchoyoshitaka | Owned by: | ryan |
|---|---|---|---|
| Priority: | normal | Milestone: | 3.3 |
| Component: | Performance | Version: | |
| Severity: | trivial | Keywords: | has-patch |
| Cc: | Focuses: |
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)
Note:
See TracTickets
for help on using tickets.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
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?