hook form submit being called twice In the following code custom call back function is being printed twice. How to prevent submit call back function being called twice.

function my_module_form_alter(&amp;$form, &amp;$form_state, $form_id){
 if ($form['#id'] == "views-exposed-form-test-page"){
    $form['#submit'][] = 'custom_callback';
  }
}

function custom_callback($form,&amp;$form_state){
    $form_state['redirect'] = false;
    dpm("insert record");
}
hook_form_alter() will fire once for every time there is a form on the current page. 

You can try the hook hook_form_FORM_ID_alter(). This will only run once when the form with the specific ID pops up. 

Unfortunately I had this issue happen before, the hook_form_alter() ran multiple times. I stopped the code from running multiple times by encapsulating the code inside an IF statement inside the hook_form_alter() example: if($form_id == my_id). So the hook ran multiple times but the code only ran once.