Opened 8 years ago
Last modified 7 years ago
#44737 reviewing defect (bug)
WP_Query: in searches post_status should consider exclude_from_search
| Reported by: | felipeelia | Owned by: | SergeyBiryukov |
|---|---|---|---|
| Priority: | normal | Milestone: | Future Release |
| Component: | Query | Version: | |
| Severity: | normal | Keywords: | has-patch has-unit-tests needs-dev-note |
| Cc: | Focuses: |
Description
When post_status is empty and we are running a search, this code is executed (wp-includes/class-wp-query.php:2446):
// Add public states. $public_states = get_post_stati( array( 'public' => true ) ); foreach ( (array) $public_states as $state ) { if ( 'publish' == $state ) { // Publish is hard-coded above. continue; } $where .= " OR {$wpdb->posts}.post_status = '$state'"; }
That way the exclude_from_search parameter isn't considered.
Attachments (3)
Change History (12)
This ticket was mentioned in Slack in #core by david.baumwald. View the logs.
7 years ago
#5
@
7 years ago
- Keywords needs-dev-note added
This ticket was discussed during 5.3 Bug Scrub 1. Since this possible alters search results, this should be communicated with a dev note.
This ticket was mentioned in Slack in #core by marybaum. View the logs.
7 years ago
#7
@
7 years ago
@SergeyBiryukov How do you feel about this one landing in 5.3? Is there anything esle you need to make that happen?
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
update test