WordPress.org

Making WordPress.org

Changeset 9318


Ignore:
Timestamp:
12/10/2019 07:57:31 PM (8 months ago)
Author:
coffee2code
Message:

Developer: Rename rerun_empty_search() to rerun_search_without_results() to clarify its purpose.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/search.php

    r9317 r9318  
    2626        add_filter( 'posts_orderby', array( __CLASS__, 'search_posts_orderby' ), 10, 2 );
    2727        add_filter( 'the_posts',     array( __CLASS__, 'redirect_empty_search' ), 10, 2 );
    28         add_filter( 'the_posts',     array( __CLASS__, 'rerun_empty_search' ), 10, 2 );
     28        add_filter( 'the_posts',     array( __CLASS__, 'rerun_search_without_results' ), 10, 2 );
    2929        add_action( 'wp_head',       array( __CLASS__, 'noindex_for_search' ), 9 );
    3030    }
     
    246246
    247247    /**
    248      * Potentially rerun a search if no posts were found.
     248     * Potentially reruns a search if no posts were found.
    249249     *
    250250     * Situations:
    251251     * - For an exact search, try again with the same criteria but without exactness
    252252     * - For a search containing characters that can be converted to HTML entities,
    253      * , try again after converting those characters
     253     *   try again after converting those characters
    254254     *
    255255     * @access public
     
    259259     * @return array
    260260     */
    261     public static function rerun_empty_search( $posts, $query ) {
    262         if ( is_search() && ! $query->found_posts ) {
     261    public static function rerun_search_without_results( $posts, $query ) {
     262        if ( $query->is_search() && ! $query->found_posts ) {
    263263            $s = $query->get( 's' );
    264264
Note: See TracChangeset for help on using the changeset viewer.