Lock down of the WordPress admin is so Frustrating. So in this article, I’ll let you know how you can create admin user without cpanel and MYSQL Details
Why Did You May need to Add an Admin User in WordPress Using FTP?
Sometimes it happens when we forgot our admin username, password, and email and in that situation, we’re unable to login to the wordpress dashboard.
so there is one method by SQL query through which you can insert admin user but you wouldn’t want to run complicated SQL query.
So let me explain how you can do that with the help of your FTP.
function wpb_admin_account(){ $user = 'Username'; $pass = 'Password'; $email = 'email@domain.com'; 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','wpb_admin_account');
After putting the code don’t forget to change the username, password, and email address.
After changing the values save it and upload it to FTP.
Now go back to your website’s admin URL and refresh it and put the username/email and password that you have just changed the file and login.
Once you have logged in then go to your function file and remove the added code from the file.
that’s it for now, Hope you guys like this. We will come up with another blog post soon.
if you have any queries or any questions about this code snippets. Contact us for more information.