Home Replace the placeholder text in WordPress default search field
Reply: 0

Replace the placeholder text in WordPress default search field

user832
1#
user832 Published in May 24, 2018, 11:15 pm

There is a known working method of how to replace the whole WordPress search field, including the placeholder text.

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' );

How could I replace only the placeholder default text without altering the form code and the language files?

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.331015 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO