Creating WordPress admin user through FTP is easy. You might need this solution if
- You are having trouble logging in to your WordPress
- The password reset link is not working
- You are a developer and client have not provided admin access
- or any other related issue (please comment below)
Solution:
- Open FTP client such as FileZilla and login to your FTP account
- Navigate to wp-content/themes folder of your site
- Open the currently active* theme folder
- Inside active theme folder, open functions.php file
- Copy and paste the following code at the end of functions.php:
* To know the active theme name, in Chrome browser: Open DevTools > Sources > Wp-Content > Theme ‘Active theme name will be visible there’.
function admin_account(){ $user = 'Username'; // Enter unique username $pass = 'Password'; // Enter desired password $email = 'email@domain.com'; // Enter unique email 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','admin_account');
- Change username, password, and email to something unique which has never been used on that site earlier.
- Save changes.
- Now open your WordPress site login page and login to your account
- You are now logged in.
Still having difficulty, contact us here