Created
September 30, 2020 11:40
-
-
Save ozrabal/dacba607e51bf28fe670b4d59c093fdd to your computer and use it in GitHub Desktop.
Create user in Wordpress
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (!username_exists('username')) { | |
$user_id = wp_create_user( 'username', 'password', 'email@email'); | |
$user = new WP_User( $user_id ); | |
$user->set_role( 'administrator' ); | |
print_r($user); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment