diff --git a/wp-includes/general-template.php b/wp-includes/general-template.php index 17c6416a57..281cc5b8f6 100644 --- a/wp-includes/general-template.php +++ b/wp-includes/general-template.php @@ -153,32 +153,49 @@ 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 ) { + static $search_form_counter = 0; + do_action( 'pre_get_search_form' ); $format = apply_filters( 'search_form_format', 'xhtml' ); + // Initialize the values + $form_id = $search_form_counter ? '' : ' id="searchform"'; + $submit_id = $search_form_counter ? '' : ' id="searchsubmit"'; + $text_id = $search_form_counter ? 's-' . $search_form_counter : 's'; + $search_form_template = locate_template( 'searchform.php' ); if ( '' != $search_form_template ) { ob_start(); require( $search_form_template ); $form = ob_get_clean(); } else { - $type = ( 'html5' === $format ) ? 'search' : 'text'; - $placeholder = ( 'html5' === $format ) ? 'placeholder="' . esc_attr_x( 'Search …', 'placeholder' ) . '" ' : ''; - - $form = ''; + if ( 'html5' == $format ) { + $form = ''; + } else { + $form = ''; + } } $result = apply_filters( 'get_search_form', $form ); if ( null === $result ) $result = $form; + $search_form_counter++; + if ( $echo ) echo $result; else