wp_user_insert doesn’t behave properly
-
When the plugin is active, wp_insert_user calls from a custom API don’t function correctly. I have a feeling it’s the same issue mentioned in this thread. The business end of the code is as follows:
$user_id = wp_insert_user( $user_data ); if ( ! is_wp_error( $user_id ) ) { foreach( $user_meta as $key => $val ) { update_user_meta( $user_id, $key, $val ); } }When the plugin is deactivated, the $user_id var is populated with the new user id, as expected. The user is created and all user meta is inserted. However, when the plugin is active, this call always returns “Sorry, that username already exists!” The user record is created, but the user meta update fails along with everything after that in the function. Any idea what could cause this? Thanks!
The topic ‘wp_user_insert doesn’t behave properly’ is closed to new replies.