Add a WordPress Admin with FTP

Are you an admin on a WordPress site and locked out of the admin panel? There are many different ways to recover your account, and the simplest may be to reset it access. Another way is to add an administrator through MySQL.

What happens if you do not have access to MySQL or do not have the necessary permissions to run querys? Below we will see how to add an admin user to WordPress using FTP.WordPress functions

The first thing you will need is an application FTP client.
With the application and after providing the necessary information you can connect via FTP or SFTP to hosting your page.

Once logged in to your WordPress site, you'll need to find the functions.php file in your WordPress theme. It's usually on the way:

/http-content/themes/the-theme-page-of-the-functions.php

Download the functions.php file to you.

Open functions.php with your favorite text editor (we use Notepad++ on Windows and Geany on Linux systems). Add him below at the bottom of the file.

function iguru_admin_account(){
$user = 'Username';
$pass = '';
$email = 'email@iguru.gr';
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','iguru_admin_account');

Do not forget to replace the name (Username), ton code (Password) and email@iguru.gr with your own data.

Then save the file and then upload it back to your website using the FTP client.

Now you can sign in to your website with the account of the user you just added.

After you have logged in to your site, edit the functions.php file again to delete the name, password, and email you have added. Delete all of the above code.

iGuRu.gr The Best Technology Site in Greecefgns

every publication, directly to your inbox

Join the 2.086 registrants.

Written by Dimitris

Dimitris hates on Mondays .....

Leave a reply

Your email address is not published. Required fields are mentioned with *

Your message will not be published if:
1. Contains insulting, defamatory, racist, offensive or inappropriate comments.
2. Causes harm to minors.
3. It interferes with the privacy and individual and social rights of other users.
4. Advertises products or services or websites.
5. Contains personal information (address, phone, etc.).