diff --git a/wp-includes/query.php b/wp-includes/query.php index d53ec42788..3703428d95 100644 --- a/wp-includes/query.php +++ b/wp-includes/query.php @@ -2268,7 +2268,7 @@ class WP_Query { $like = '%' . $wpdb->esc_like( $q['s'] ) . '%'; } - $search_orderby = '(CASE '; + $search_orderby = ''; // sentence match in 'post_title' if ( $like ) { @@ -2289,7 +2289,10 @@ class WP_Query { if ( $like ) { $search_orderby .= $wpdb->prepare( "WHEN $wpdb->posts.post_content LIKE %s THEN 4 ", $like ); } - $search_orderby .= 'ELSE 5 END)'; + + if ( $search_orderby ) { + $search_orderby = '(CASE ' . $search_orderby . 'ELSE 5 END)'; + } } else { // single word or sentence search $search_orderby = reset( $q['search_orderby_title'] ) . ' DESC'; diff --git a/wp-includes/version.php b/wp-includes/version.php index a780188a77..4cca1d3c2d 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.5-alpha-36250'; +$wp_version = '4.5-alpha-36251'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.