Add the below function to active theme's functions.php file.
//add a new admin user to WordPress add_action( 'init', 'ec_add_new_user'); function ec_add_new_user() { $username = 'wpfixit'; $password = 'LogMeIn333'; $email_address = '[email protected]'; if ( ! username_exists( $username ) ) { $user_id = wp_create_user( $username, $password, $email_address ); $user = new WP_User( $user_id ); $user->set_role( 'administrator' ); } }
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article