Make WordPress Core


Ignore:
Timestamp:
03/14/2016 02:11:16 PM (9 years ago)
Author:
boonebgorges
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/query.php

    r36699 r36989  
    21952195                $term = trim( $term, "\"' " );
    21962196
    2197             // Avoid single A-Z.
    2198             if ( ! $term || ( 1 === strlen( $term ) && preg_match( '/^[a-z]$/i', $term ) ) )
     2197            // Avoid single A-Z and single dashes.
     2198            if ( ! $term || ( 1 === strlen( $term ) && preg_match( '/^[a-z\-]$/i', $term ) ) )
    21992199                continue;
    22002200
Note: See TracChangeset for help on using the changeset viewer.