Site logo

Archived topic

Change "Search... " to another word in the Search button

9 replies · Started by Peter on April 21, 2021

Viewing posts 1–10 of 10

I am using this PHP code as a basis of changing "Search..." to "Seek..." in the search button:

add_filter( 'filter_name', 'UTL_change_search_word' );
function UTL_change_search_word()
{
return 'Your new value';
}

Where "UTL–change_search_word" is the new function name.

How do I complete the code?
Can I add it to the functions.php in the Child Theme?

Hi there,

Any chance you can link us to the site in question?

You can use the private information field.

Let me know :)

yes, here are the credentials...

Hi there,

You can try this PHP filter.

add_filter( 'generate_search_placeholder', 'search_placeholder' );
function search_placeholder()
{ 
    return 'Seek…';
}

Thanks, Elvin - uploading the filter to the child theme (and of course activating the child theme) succeed in deleting “Search...” in the search widget box, but did not replace it. The box became empty.
So I restored the original configuration so that “Search...” is back inside the box. We seem to be on the right track. Any other suggestions?

Best
Peter

Hi Peter,

Try this snippet instead:

add_filter( 'generate_search_placeholder', 'search_placeholder' );
function search_placeholder()
{ 
    echo 'Seek…';
}

Let me know :)

OK! It worked except that instead of "...", there was a diamond shape with a question mark.

So I replaced "..." in the filter thus:

add_filter( 'generate_search_placeholder', 'search_placeholder' );
function search_placeholder()
{
echo 'Seek …';
}

Now it works! Thank you very much.

You are welcome :)

I see that the message above doesn't show the HTML code that produces the dot-dot-dot. The line should be

echo 'Seek [ampersand]hellip[semicolon]';

thanks

Thanks for sharing :)

This archived topic is closed to new replies.