Opened 16 years ago
Closed 16 years ago
#8851 closed defect (bug) (fixed)
invalid XHTML markup in get_search_form function in general-template.php
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | 2.8 | Priority: | normal |
Severity: | normal | Version: | |
Component: | General | Keywords: | |
Focuses: | Cc: |
Description
Old function:
function get_search_form() {
do_action( 'get_search_form' );
if ( != locate_template(array('searchform.php'), true) )
return;
$form = '<form method="get" id="searchform" action="' . get_option('home') . '/" >
<label class="hidden" for="s">' . ('Search') . '</label>
<div><input type="text" value="' . attribute_escape(apply_filters('the_search_query', get_search_query())) . '" name="s" id="s" />
<input type="submit" id="searchsubmit" value="'.attribute_escape(('Search')).'" />
</div>
</form>';
echo apply_filters('get_search_form', $form);
}
New Function:
function get_search_form() {
do_action( 'get_search_form' );
if ( != locate_template(array('searchform.php'), true) )
return;
$form = '<form method="get" id="searchform" action="' . get_option('home') . '/" >
<div><label class="hidden" for="s">' . ('Search') . '</label>
<input type="text" value="' . attribute_escape(apply_filters('the_search_query', get_search_query())) . '" name="s" id="s" />
<input type="submit" id="searchsubmit" value="'.attribute_escape(('Search')).'" />
</div>
</form>';
echo apply_filters('get_search_form', $form);
}
Forgot to add. This corrects the fact that the search form doesn't validate according to XHTML standards. Will be correct for standard HTML as well.