I'm writing a simple API endpoint which allows a 3rd party site to create new users. Everything works but the 3rd party site is set up to only wait 5 seconds, and for some reason, when I create a new user and then call wp_new_user_notification() it takes around 5 full seconds to send the response. Half the time the 3rd party site times out waiting.
When I comment out the new user notification, it's almost instant. So I know the slowness is coming from that line of code. I have two plugins that deal with new user emails, but I experimented by deactivating both of them and it's still slow. Any ideas why this is happening? I looked at the source code for the function, and it doesn't look like it should take that long.
Thanks for any advice you can give me!
UPDATE:
I did a test using wp_mail()...
$time3 = time();
wp_mail( "me@gmail.com", "SUBJECT", "MESSAGE" );
$time4 = time();
echo "wp_mail(): ". ($time4 - $time3);
And I get back wp_mail(): 1
I think this suggests that the delay is inside wp_new_user_notification() but outsidewp_mail()`.
UPDATE2: I'm not receiving any email from wp_mail() when I use it in my plugin. Perhaps there's some dependency that I'm missing.
wp_mail()so try testing it. – Rarst♦ Sep 28 '12 at 18:02