Make WordPress Core

Changeset 23800


Ignore:
Timestamp:
03/26/2013 09:08:04 PM (14 years ago)
Author:
SergeyBiryukov
Message:

Rename 'get_search_form' action to 'pre_get_search_form' to prevent collision with the filter of the same name. Make sure the filtered result is not null to prevent search form from disappearing if an action function is attached to the old hook. fixes #19321.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/general-template.php

    r23798 r23800  
    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.
    … …  
    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' );
    … …  
    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
Note: See TracChangeset for help on using the changeset viewer.