Change the placeholder text of the search widget


this is a very simple question: Is there a way to change the palceholder text in the search widget (to a different language at least)? I’m talking about this:

If not, this would be a nice feature to add.

Hi Matthias,

Nearly every aspect of the theme can be translated. Please read the last section of this article which is the quickest way to translate.

But I am not sure the section you are talking about is related to our theme, If it is a widget that you add from Appearance > Widgets it is not part of the theme and you need to consider translating the WordPress itself:

Thank you.

1 Like

Thank you!
I just wanted to add that I also wanted to change the text in the search “lightbox” that opens up when you click search in the header, but that seems to be also covered in the other post.

Hi There,

To translate those text, please add this custom code under functions.php file locates in your child theme:

function my_custom_strings($translated_text, $text, $domain) {
	$translated_text = str_replace("Type and Press “enter” to Search", "Your text", $translated_text);
	$translated_text = str_replace("Search", "Your text", $translated_text);
	return $translated_text;
add_filter('gettext', 'my_custom_strings', 100, 3);

Hope it helps :slight_smile:

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.