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
This commit is contained in:
Sergey Biryukov 2013-03-26 21:08:04 +00:00
parent f8a9f1dd3e
commit ae48aed870

View File

@ -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;
}
/**