action is not called after a php request

I just solved it!

The problem was, that the php request handling works different in wordpress.
There has to be a workaround with a admin_post.php hook:

Instead of if( isset($_POST['email']) && isset($_POST['title']) ){...}

I had to use this hook:

add_action( 'admin_post_nopriv_process_form', 'process_form_data' );
add_action( 'admin_post_process_form', 'process_form_data' );
function process_form_data() {
  my_function($_POST['email'],$_POST['title']);
  wp_redirect($_POST['url']);
}

A hidden form field is used to hook in this function. For the redirect, I created another hidden field in the form, to redirect to user back to the previous site:

  $current_url="//".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
  //...
  $result .= '<input type="hidden" name="url" value="'.$current_url.'">'; //redirect
  $result .= '<input type="hidden" name="action" value="process_form">'; //hook

Source: adaptiveweb.com

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)