Make WordPress Core

Ticket #19321: 19321.3.patch

File 19321.3.patch, 1.3 KB (added by SergeyBiryukov, 11 years ago)
  • 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 *
     
    151151 * @return string|null String when retrieving, null when displaying or if searchform.php exists.
    152152 */
    153153function get_search_form( $echo = true, $format = 'xhtml' ) {
    154         do_action( 'get_search_form' );
     154        do_action( 'pre_get_search_form' );
    155155
    156156        $search_form_template = locate_template( 'searchform.php' );
    157157        if ( '' != $search_form_template ) {
     
    171171                </form>';
    172172        }
    173173
     174        $result = apply_filters( 'get_search_form', $form );
     175        if ( null === $result )
     176                $result = $form;
     177
    174178        if ( $echo )
    175                 echo apply_filters( 'get_search_form', $form );
     179                echo $result;
    176180        else
    177                 return apply_filters( 'get_search_form', $form );
     181                return $result;
    178182}
    179183
    180184/**