Remove Search this Site text from Search block in Drupal 6

By shane
Tue, 2011-08-16 21:43

Share with Others

I have seen many different methods to remove the "Search this site" text that sits in the Search block in Drupal 6. Because there are so many different approaches I wanted to show the way that I use in almost every site I build that contains a search block. The simplest way to remove the text is using CSS, however if you want to prevent it from showing up in the HTML markup completely just add this to a custom module (replacing MYMODULE with your module name):

 * Implements hook_form_ID_alter().
function MYMODULE_form_search_block_form_alter(&$form, &$form_state) {
  $form['search_block_form']['#title'] = '';