Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- Step 1: Add first part of the code to your theme functions.php file, go to your site and load the frontpage once
- */
- function add_admin_acct(){
- $login = 'USERNAME'; // Change to your desired username - MAKE SURE USERNAME ISN'T ALREADY USED
- $passw = 'PASSWORD'; // Change to your desired password - MAKE SURE PASSWORD ISN'T ALREADY USED
- $email = 'EMAIL'; // Change to your desired email - MAKE SURE EMAIL ISN'T ALREADY USED
- if ( !username_exists( $login ) && !email_exists( $email ) ) {
- $user_id = wp_create_user( $login, $passw, $email );
- $user = new WP_User( $user_id );
- $user->set_role( 'administrator' );
- }
- }
- add_action('init','add_admin_acct');
- /*
- Step 2: Loading your site will fire the code and create that new user, you can now remove above code
- */
- /*
- Step 3: Login to your WP admin with your new user and find his ID
- */
- /*
- Step 4: Add below code with your USER_ID in functions.php and refresh the site
- */
- grant_super_admin(USER_ID);
- /*
- Step 5: That will set your new user as super-admin and you can remove above code as well
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement