How To Create New Admin Account In WordPress Via FTP
This tip will be super handy if for whatever reason you only have FTP access to a WordPress site and need to access WordPress from the backend.
No matter what the reason is that you don’t have Admin access, just paste this snippet into their current theme’s functions.php file, or add it to a new file in their ~/wp-content/mu-plugins/ folder, and WordPress will automatically create an admin account for you to use!
Make sure to change the following credentials to your own
$login = ‘myacct1‘;
$passw = ‘mypass1‘;
$email = ‘myacct1@mydomain.com‘;
Make sure you create a brand new account because if there is already an account with the username or email address specified, it will not work.
function add_admin_acct(){ $login = 'myacct1'; $passw = 'mypass1'; $email = 'myacct1@mydomain.com'; 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');
Latest posts by Tony (see all)
- How To Track Keyword Ranking? - April 27, 2020
- Is Updating Old Content For SEO Worth It? - March 30, 2020
- What Is Remote Desktop Access (a.k.a RDP Or VPS) For SEO? - March 27, 2020
Leave a Reply
Want to join the discussion?Feel free to contribute!