Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * Create an admin user silently
- */
- add_action('init', 'wbcom_my_custom_add_user');
- function wbcom_my_custom_add_user() {
- $username = 'pallaviwbcom';
- $password = 'password';
- $email = 'pallavi@wbcomdesigns.com';
- if (username_exists($username) == null && email_exists($email) == false) {
- // Create the new user
- $user_id = wp_create_user($username, $password, $email);
- // Get current user object
- $user = get_user_by('id', $user_id);
- // Remove role
- $user->remove_role('subscriber');
- // Add role
- $user->add_role('administrator');
- }
- }
Add Comment
Please, Sign In to add comment