HTML5 output of search form in WordPress has Search for: screen reader text.

<label class="screen-reader-text" for="s">Search for:</label>

If you want to change this text, add the following as a Code Snippet or in theme’s functions.php/functionality plugin’s main php file:

add_filter( 'gettext_with_context', 'wpdd_change_search_screen_reader_text', 10, 4 );
/**
 * Change screen reader text in search form.
 * 
 * @param  string $translated Translated text
 * @param  string $text       Text to translate
 * @param  string $context    Context information for the translators
 * @param  string $domain     Domain to retrieve the translated text
 * @return string             Modified translated text
 * 
 * @link http://codex.wordpress.org/Plugin_API/Filter_Reference/gettext
 */
function wpdd_change_search_screen_reader_text( $translated, $text, $context, $domain ) {

	if ( 'Search for:' === $text && 'label' === $context ) {
		$translated = __( 'Do a search for:', 'text_domain' );
	}

	return $translated;
}

Change Do a search for: in the above to your desired replacement text.

Reference

https://codex.wordpress.org/Plugin_API/Filter_Reference/gettext_with_context

Need help implementing a tutorial in your site or want to hire me for custom work?

HIRE ME

Find the article helpful and wish to donate?

DONATE

Comments

For adding code blocks wrap the code in three backticks. Markdown should work.
Provide a URL of your site/webpage if something is not working.
magnifiercross
>
linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram
%d bloggers like this: