WordPress.org

Make WordPress Core

Ticket #39717: search_terms_count.patch

File search_terms_count.patch, 799 bytes (added by msaari, 4 years ago)

Patch to correct /wp-includes/class-wp-query.php, in correct format

  • src/wp-includes/class-wp-query.php

     
    13091309                        $q['search_terms'] = array( $q['s'] );
    13101310                } else {
    13111311                        if ( preg_match_all( '/".*?("|$)|((?<=[\t ",+])|^)[^\t ",+]+/', $q['s'], $matches ) ) {
    1312                                 $q['search_terms_count'] = count( $matches[0] );
    13131312                                $q['search_terms'] = $this->parse_search_terms( $matches[0] );
     1313                                $q['search_terms_count'] = count( $q["search_terms"] );
    13141314                                // if the search string has only short terms or stopwords, or is 10+ terms long, match it as sentence
    13151315                                if ( empty( $q['search_terms'] ) || count( $q['search_terms'] ) > 9 )
    13161316                                        $q['search_terms'] = array( $q['s'] );