Query: Ignore search terms consisting of a single dash.

Due to the "exclude" support added in WP 4.4, single dashes were being
converted to "NOT LIKE '%%'" clauses, causing all searches to fail.

Ports [36989] to the 4.4 branch.

Props RomSocial, swissspidy.
Fixes #36195.

Built from https://develop.svn.wordpress.org/branches/4.4@37082


git-svn-id: http://core.svn.wordpress.org/branches/4.4@37049 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Boone Gorges 2016-03-25 18:41:27 +00:00
parent 71788d7c89
commit f2410b407d
1 changed files with 2 additions and 2 deletions

View File

@ -2231,8 +2231,8 @@ class WP_Query {
else
$term = trim( $term, "\"' " );
// Avoid single A-Z.
if ( ! $term || ( 1 === strlen( $term ) && preg_match( '/^[a-z]$/i', $term ) ) )
// Avoid single A-Z and single dashes.
if ( ! $term || ( 1 === strlen( $term ) && preg_match( '/^[a-z\-]$/i', $term ) ) )
continue;
if ( in_array( call_user_func( $strtolower, $term ), $stopwords, true ) )