From the Codex Docs: The is_search()
Conditional Tag checks if search result page archive is being displayed. This is a boolean function, meaning it returns either TRUE
or FALSE
.
<?php $search_box_term = is_search() ? get_search_query() : 'DEFAULT SEARCHBOX STRING'; ?>
<input type="text" value="<?php echo $search_box_term; ?>" name="s">
So this ↑ shows either DEFAULT SEARCHBOX STRING
or the searched terms if you´re on a search results page.
EDIT: Here´s a filter that you can drop instead into your functions.php file:
function wpse50321_alter_search_form( $form )
{
return '<form role="search" method="get" id="searchform" action="' . esc_url( home_url( "https://wordpress.stackexchange.com/" ) ) . '" >
<input type="text" value="' . ( is_search() ? get_search_query() : 'DEFAULT SEARCHBOX STRING' ) . '" name="s" id="s" />
<input type="submit" id="searchsubmit" value="'. esc_attr__('Go') .'" />
</form>';
}
add_filter( 'get_search_form', 'wpse50321_alter_search_form', 99999 );