Created
May 11, 2014 11:42
-
-
Save tsbits/3869bc4d5d9e36f754ab to your computer and use it in GitHub Desktop.
Create sample user on 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
//This script creat a lot of 'fake' users for your WordPress | |
//Usefull for developper | |
//This is a modified version of that script : http://wpengineer.com/2054/create-users-automatically-in-wordpress/ | |
//Add this to the functions.php file of your theme then visite the dashboard. | |
function fb_wp_insert_user(){ | |
for ($i = 1; $i <= 100; $i++) { | |
$user_data = array( | |
'ID' => '', | |
'user_pass' => wp_generate_password(), | |
'user_login' => 'dummy'.$i, | |
'user_nicename' => 'Dummy'.$i, | |
'user_url' => '', | |
'user_email' => 'dummy'.$i.'@example.com', | |
'display_name' => 'Dummy'.$i, | |
'nickname' => 'dummy'.$i, | |
'first_name' => 'Dummy'.$i, | |
'user_registered' => '2010-05-15 05:55:55', | |
'role' => get_option('default_role') // Use default role or another role, e.g. 'editor' | |
); | |
$user_id = wp_insert_user( $user_data ); | |
} | |
} | |
add_action( 'admin_init', 'fb_wp_insert_user' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment