WordPress.org

Make WordPress Core

Ticket #19321: 19321.4.patch

File 19321.4.patch, 1.3 KB (added by SergeyBiryukov, 7 years ago)

Refreshed after [23798]

  • wp-includes/general-template.php

     
    141141 * form into the sidebar and also by the search widget in WordPress.
    142142 *
    143143 * There is also an action that is called whenever the function is run called,
    144  * 'get_search_form'. This can be useful for outputting JavaScript that the
     144 * 'pre_get_search_form'. This can be useful for outputting JavaScript that the
    145145 * search relies on or various formatting that applies to the beginning of the
    146146 * search. To give a few examples of what it can be used for.
    147147 *
     
    153153 * @return string|null String when retrieving, null when displaying or if searchform.php exists.
    154154 */
    155155function get_search_form( $echo = true ) {
    156         do_action( 'get_search_form' );
     156        do_action( 'pre_get_search_form' );
    157157
    158158        $format = apply_filters( 'search_form_format', 'xhtml' );
    159159
     
    175175                </form>';
    176176        }
    177177
     178        $result = apply_filters( 'get_search_form', $form );
     179        if ( null === $result )
     180                $result = $form;
     181
    178182        if ( $echo )
    179                 echo apply_filters( 'get_search_form', $form );
     183                echo $result;
    180184        else
    181                 return apply_filters( 'get_search_form', $form );
     185                return $result;
    182186}
    183187
    184188/**