[wp-trac] [WordPress Trac] #55431: add_theme_support for html5 on search-form not working

WordPress Trac noreply at wordpress.org
Mon Mar 21 15:00:50 UTC 2022

#55431: add_theme_support for html5 on search-form not working
 Reporter:  blackawxs      |      Owner:  (none)
     Type:  defect (bug)   |     Status:  new
 Priority:  normal         |  Milestone:  Awaiting Review
Component:  Bundled Theme  |    Version:
 Severity:  normal         |   Keywords:
  Focuses:                 |
 I’m on WordPress 5.9.2 and using TwentyTwentyOne version 1.5

 I have a very odd situation within my child theme, in which the built in
 search form is not converting to HTML5 syntax.

 From my child theme I have the following files

 – style.css
 – screenshot.png
 – functions.php
 – front-page.php

 Within my functions.php, I have the following code:

   function _ags_after_setup_theme() {
     add_theme_support( 'html5', array( 'search-form' ) );
   add_action( 'after_setup_theme', '_ags_after_setup_theme' );

 Within my font-page.php I have the following code :

  * @link https://developer.wordpress.org/themes/basics/template-hierarchy
  * @package WordPress
  * @subpackage Twenty_Twenty_One
  * @since Twenty Twenty-One 1.0


 <p>the beginning of our front page content</p>
 <div class="search-form-container">
   <?php get_search_form(); ?>


 And when I go to my front page, the search form still looks like the
 following syntax:

  <form role="search" method="get" class="search-form"
         <label for="search-form-1">Search…</label>
         <input type="search" id="search-form-1" class="search-field"
 value="" name="s">
         <input type="submit" class="search-submit" value="Search">

 As you can see, no HTML5 conversion on the form.

 Why is that?

Ticket URL: <https://core.trac.wordpress.org/ticket/55431>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform

More information about the wp-trac mailing list