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.
git-svn-id: https://develop.svn.wordpress.org/trunk@23800 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
f9316e4a8b
commit
26c02ab51c
@ -141,7 +141,7 @@ function get_template_part( $slug, $name = null ) {
|
||||
* form into the sidebar and also by the search widget in WordPress.
|
||||
*
|
||||
* There is also an action that is called whenever the function is run called,
|
||||
* 'get_search_form'. This can be useful for outputting JavaScript that the
|
||||
* 'pre_get_search_form'. This can be useful for outputting JavaScript that the
|
||||
* search relies on or various formatting that applies to the beginning of the
|
||||
* search. To give a few examples of what it can be used for.
|
||||
*
|
||||
@ -153,7 +153,7 @@ function get_template_part( $slug, $name = null ) {
|
||||
* @return string|null String when retrieving, null when displaying or if searchform.php exists.
|
||||
*/
|
||||
function get_search_form( $echo = true ) {
|
||||
do_action( 'get_search_form' );
|
||||
do_action( 'pre_get_search_form' );
|
||||
|
||||
$format = apply_filters( 'search_form_format', 'xhtml' );
|
||||
|
||||
@ -175,10 +175,14 @@ function get_search_form( $echo = true ) {
|
||||
</form>';
|
||||
}
|
||||
|
||||
$result = apply_filters( 'get_search_form', $form );
|
||||
if ( null === $result )
|
||||
$result = $form;
|
||||
|
||||
if ( $echo )
|
||||
echo apply_filters( 'get_search_form', $form );
|
||||
echo $result;
|
||||
else
|
||||
return apply_filters( 'get_search_form', $form );
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user