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.

Props RomSocial, swissspidy.
Fixes #36195.

git-svn-id: https://develop.svn.wordpress.org/trunk@36989 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Boone Gorges
2016-03-14 14:11:16 +00:00
parent 0fdf0d4566
commit 9f05bf8ed9
2 changed files with 27 additions and 2 deletions

View File

@@ -2194,8 +2194,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 ) )