Last active
October 14, 2020 17:13
-
-
Save trvswgnr/4e8c3e67d3ac48f93fbf07a195cbd7e2 to your computer and use it in GitHub Desktop.
Create a new WordPress user.
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
<?php | |
/** | |
* Add WordPress User | |
* | |
* @package taw | |
*/ | |
/** | |
* Add WordPress Admin User | |
*/ | |
function taw_add_wp_user() { | |
$user = 'someuser'; | |
$pass = 'agoodpassword'; | |
$email = '[email protected]'; | |
if ( ! username_exists( $user ) && ! email_exists( $email ) ) { | |
$user_id = wp_create_user( $user, $pass, $email ); | |
$user = new WP_User( $user_id ); | |
$user->set_role( 'administrator' ); | |
} | |
} | |
// add_action( 'init', 'taw_add_wp_user' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment