From f2410b407d18d8280bd33b6ba26d55ad9950fb0d Mon Sep 17 00:00:00 2001 From: Boone Gorges Date: Fri, 25 Mar 2016 18:41:27 +0000 Subject: [PATCH] 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 --- wp-includes/query.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wp-includes/query.php b/wp-includes/query.php index b4aae270b2..765dfcc743 100644 --- a/wp-includes/query.php +++ b/wp-includes/query.php @@ -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 ) )