I have two actions. One is after saving a post, so
I have a second action triggered via AJAX, so
add_action( 'wp_ajax_nopriv_saveTaskPriority', 'saveTaskPriority' ); add_action( 'wp_ajax_saveTaskPriority', 'saveTaskPriority' );
saveTaskPriority, I have the following code:
$to = array('firstname.lastname@example.org'); $subject = 'foo'; $body = 'bar'; wp_mail($to, $subject, $body);
The only difference is, in the ajax function, I have
die('hi'); at the end.
I KNOW the ajax method is being called, because I am returning data and
console.logging it. (Meaning I see 'hi' in the response of the POST in chrome developer tools)
I get the email from the
save_post action, but not the ajax action. What gives?
If I use straight up
mail() in the ajax function, it works.