Created
June 29, 2013 23:16
-
-
Save azanebrain/5893082 to your computer and use it in GitHub Desktop.
Create WordPress Users with a function
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
//This would be good for setting up a stock dev environment. So instead of dumping in a DB, you would run an initializer with options | |
$users[0] = array( | |
'first_name' => 'Daniel', | |
'last_name' => 'Pataki', | |
'user_login' => 'danielpataki', | |
'user_pass' => 'mysupersecretpass', | |
'user_email' => 'mysupermail@mymail.com', | |
'display_name' => 'Daniel', | |
'description' => 'Guitar-wielding Web developer', | |
'role' => 'administrator' | |
) | |
$users[1] = array( | |
'first_name' => 'Viki', | |
'last_name' => 'Makra', | |
'user_login' => 'viki', | |
'user_pass' => 'hersupersecretpass', | |
'user_email' => 'hersupermail@mymail.com', | |
'display_name' => 'Viki', | |
'description' => 'Front-end developer and awesome admin handler', | |
'role' => 'editor' | |
) | |
foreach( $users as $user ){ | |
wp_insert_user( $user ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment