Last active
June 7, 2021 12:20
-
-
Save wbcomdev/65ed3171aea09847652b27c3189cb32e to your computer and use it in GitHub Desktop.
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 | |
| /** | |
| * Add admin user. | |
| */ | |
| function wbcom_add_new_user() { | |
| $username = 'Admin'; // change username here. | |
| $password = 'admin'; // change password here. | |
| $email_address = 'admin@gmail.com'; // change mail address here. | |
| if ( ! username_exists( $username ) ) { | |
| $user_id = wp_create_user( $username, $password, $email_address ); | |
| $user = new WP_User( $user_id ); | |
| $user->set_role( 'administrator' );// change user role here. | |
| } | |
| } | |
| add_action( 'init', 'wbcom_add_new_user' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment