#19198 closed defect (bug) (fixed)
Die fast in get_posts if in_search_post_types returns nothing
| Reported by: | mitchoyoshitaka | Owned by: | ryan |
|---|---|---|---|
| Priority: | normal | Milestone: | 3.7 |
| Component: | Query | Version: | 3.2.1 |
| Severity: | minor | Keywords: | has-patch |
| Cc: | Focuses: |
Description
From a comment of mine in #18364, which nacin suggested was worth a follow-up ticket:
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?
Attachments (4)
Change History (10)
Note:
See TracTickets
for help on using tickets.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
This patch incorporates two decisions:
nullto the list ofpost_types in (), but then trivial cases such aspost_types in (null, 'post')has the potential of being (probably only a little) slower thanpost_types in ('post'). The solution presented here just makes itpost_types in (null)in cases when$in_search_post_typesis empty.Feedback welcome.