Easy Steps to Add WordPress Admin User Using FTP

add-admin-user-cover-image

Today we are going to explain you about Creating New User with Admin Privilege in WordPress using FTP. Some of the software are Filezilla, cuteFTP and smartFTP etc.

FTP (File Transfer Protocol)

File Transfer Protocol is a network Protocol which helps us to transfer computer data and files from a client to a server on a computer network.

Add Admin UserUsing FTP

First of all you need to Login in your FTP using credentials. After login you need to find out functions.php file and download it in your local server as below:

wordpress-functions.php-file-download

(i.e. /example.com/wp-content/themes/your-active-theme/functions.php).

After downloading it open your downloaded file with help of text-editor and add the following code snippet at the bottom of the file.

function create_admin_account(){
$username = ‘yourusername’;
$mypass = ‘yourpassword’;
$email = ‘your@email.com’;

if ( !username_exists( $username ) && !email_exists( $email ) ) {
$user_id = wp_create_user( $username, $mypass, $email );
$user = new WP_User( $user_id );
$user->set_role( ‘administrator’ );
}
}
add_action(‘init’,’create_admin_account’);

You need to change yourusername, yourpassword and your@email.com with actual values. After adding these details, upload this file functions.php again and you can login to your WordPress dashboard.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *