From ae48aed870c8a057b3def6136236b6769629b143 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Tue, 26 Mar 2013 21:08:04 +0000 Subject: [PATCH] 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: http://core.svn.wordpress.org/trunk@23800 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/general-template.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/wp-includes/general-template.php b/wp-includes/general-template.php index ed225da83d..17c6416a57 100644 --- a/wp-includes/general-template.php +++ b/wp-includes/general-template.php @@ -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 ) { '; } + $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; } /**