function wp_create_user($username, $password, $email = '') {}

A simpler way of inserting an user into the database.
Creates a new user with just the username, password, and email. For more complex user creation use wp_insert_user() to specify more information.


  • string $username: The user’s username.
  • string $password: The user’s password.
  • string $email: The user’s email (optional).

Return values

returns:The new user’s ID.

Source code

function wp_create_user($username, $password, $email = '') {

	$user_login = esc_sql( $username );

	$user_email = esc_sql( $email    );

	$user_pass = $password;

	$userdata = compact('user_login', 'user_email', 'user_pass');

	return wp_insert_user($userdata);



No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: