Created
May 28, 2012 18:28
-
-
Save mestrewp/2820499 to your computer and use it in GitHub Desktop.
WordPress: Create New User
This file contains hidden or 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
<?php | |
/* | |
save as 'create-new-user.php' | |
upload to /wp-content/mu-plugins/ | |
(you may have to create the 'mu-plugins' folder) | |
*/ | |
add_action('init', 'create_new_user' ); | |
function create_new_user() { | |
$un = 'username'; | |
$pw = 'password'; | |
$id = wp_create_user( $un, $pw ); | |
$user = new WP_User( $id ); | |
$user->set_role( 'administrator' ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment