Note about translations : before you start coding anything, note that the “Search” string in the search forms is a WordPress string. If this string is not translated in your language, make sure you update your WordPress language translation on WordPress Polyglots.
In case you want to change the default word “Search” in the Search Button, into something different, this snippet will allow to change it.
Just paste this function into your child-theme functions.php file.
/*********************************/ /* Change Search Button Text /**************************************/ // Add to your child-theme functions.php add_filter('get_search_form', 'my_search_form_text'); function my_search_form_text($text) { $text = str_replace('value="Search"', 'value="Click me"', $text); //set as value the text you want return $text; }
Note: the ‘value=”Search”‘ needs to be replaced accordingly to the default WP language installation:
‘value=”Cerca”‘ for Italian
‘value=”Suche”‘ for German and so on…
Where to copy/paste this code?
Add it to your child-theme functions.php and to your style.css.
Everything you need to know about creating a child theme with Customizr here.
One thought on “Changing the “Search” string in WordPress search forms”
Hi. I need suggestion. I am not using child theme with my site alhaqtraders.com should i use child theme? why? furthermore i don’t have coding knowledge. I work on user interface. In past when i tried to add coding i got my site damage. I reinstalled everything.