How do I use a submit callback on a Drupal admin settings form?
The default submit handler of $form_id . '_submit' only fires if no other submit handlers have been set.

Because system_settings_form() sets a submit handler, the default handler doesn't fire, so you have to specify it if you want to use it.

You can do so like this:

/**
 * A custom form.
 */
function custom_form() {
  $form = array();

  $form['custom_form_field'] = array(
    '#type' =&gt; 'textfield',
    '#title' =&gt; t('Custom form field'),
    '#default_value' =&gt; variable_get('custom_form_field', ''),
  );

  // Set a submit handler manually because the default submit handler
  // gets overridden by the system_settings_form() submit handler.
  $form['#submit'][] = 'custom_form_submit';

  return system_settings_form($form);
}

/**
 * Submit handler for the custom form.
 */
function custom_form_submit($form, &amp;$form_state) {
  // Submit code here.
}


Adding your submit handler like this means yours will run before the system_settings_form() submit handler.

If you want yours to run after, instead of:

// Set a submit handler manually because the default submit handler
// gets overridden by the system_settings_form() submit handler.
$form['#submit'][] = 'custom_form_submit';

return system_settings_form($form);


Do:

$form = system_settings_form($form);
$form['#submit'][] = 'custom_form_submit';
return $form;


Make sure not to do this though:

$form = system_settings_form($form);
$form['#submit'] = array('custom_form_submit');
return $form;


because that would overwrite the system_sttings_form() submit handler, which would defeat the purpose of using the system_settings_form() function in the first place.