Forked from vbaimas/Changing the search string in WordPress search form
Created
June 19, 2025 14:49
-
-
Save vido89/2d1a4a1839c3d6c21509bdd285257395 to your computer and use it in GitHub Desktop.
In case you want to change the default word “Search” in the Search Button, into something different, this snippet will allow to change it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*/ | |
/* Change Search Button Text | |
/*/ | |
add_filter('get_search_form', 'my_search_form'); | |
function my_search_form($text) { | |
$text = str_replace('value="Search"', 'value="ok"', $text); //set as value the text you want | |
return $text; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
/**
*/
function my_custom_search_placeholder( $form ) {
// Replace the default placeholder
$form = str_replace(
esc_attr_x( 'Search …', 'placeholder' ),
esc_attr__( 'Find on my blog …', 'text-domain' ),
$form
);
return $form;
}
add_filter( 'get_search_form', 'my_custom_search_placeholder' );