wp_mail doesn’t work when logged in?
You’ve got a typo in the hook that runs for logged in users: add_action(‘wp_ajax_search_notify_emaill’, ‘search_notify_email’); There’s an extra l in the hook name. The hook names need to be the same, apart from nopriv_, so you should have: add_action(‘wp_ajax_nopriv_search_notify_email’, ‘search_notify_email’); add_action(‘wp_ajax_search_notify_email’, ‘search_notify_email’); When you send an AJAX request with an action WordPress runs the hook … Read more