Override Search module's textfield CSS ID this is what I am using to override the Search module's submit button's CSS ID:

function hook_form_alter(&amp;$form, &amp;$form_state, $form_id) {
    if ($form_id == 'search_block_form') {
        $form['actions']['submit']['#attributes']['id'][] = 'custom_css_id';
    }
}


Now I want same thing for the textfield input.
It is the same thing as you did above

$form['search_block_form']['#attributes']['id'][] = 'custom_css_id';