Read WordPress search form change placeholder for more information.
WordPress Search Form
By default, if you are going to change the text of your search form in WordPress, we would recommend using a search plugin such as WP fastest site search. However, if you want more control or rather use code you can hook into the theme’s various filters to alter the search form placeholder in various parts of the theme.
Add a search engine to your website at 9 USD per month
Modify Placeholder attribute CODE
Modify the placeholder attribute in the following code inside the functions.php in your WordPress theme. The placeholder can be changed to any string and the search button can also be changed to anything.
function html5_search_form( $form ) { $form = '<section class="search"><form role="search" method="get" id="search-form" action="' . home_url( '/' ) . '" > <label class="screen-reader-text" for="s">' . __('', 'domain') . '</label> <input type="search" value="' . get_search_query() . '" name="s" id="s" placeholder="Search website" /> <input type="submit" id="searchsubmit" value="'. esc_attr__('Go', 'domain') .'" /> </form></section>'; return $form; } add_filter( 'get_search_form', 'html5_search_form' );
0 Comments