How to Add an Admin User in WordPress using FTP

[agentsw ua=’pc’]

Being locked of your WordPress admin is frustrating. That’s why we have shown you how to add an admin user in WordPress via MySQL. Recently one of our readers asked if it was possible to add an admin user in WordPress using FTP. Ofcourse it is. In this article, we will show you how to add an admin user in WordPress using FTP.

adminuserftp

Why You May Need to Add an Admin User in WordPress Using FTP?

Sometimes you may forget your username or email address on a WordPress site and cannot login to the admin area.

One way to do this is by adding an admin user to the WordPress database using MySQL. But you may be unable to connect to phpMyAdmin or don’t want to run MySQL queries directly.

Some users may get their site hacked and admin account deleted. In that case, adding an admin user using FTP can quickly restore your access to the WordPress admin area.

Having said that, let’s see how you can easily add an admin user in WordPress using FTP access.

Adding an Admin User in WordPress Using FTP

First thing you will need is an FTP client. If you are new to using FTP, then see our guide on how to use FTP to upload files in WordPress.

Once connected to your WordPress site, you need to locate your WordPress theme’s functions.php file. It would be at a location like this:

/yoursite.com/wp-content/themes/your-current-theme/functions.php

Right click on functions.php file and then select download. Your FTP client will download the functions.php file to your computer.

Downloading functions.php file to edit

Open the file you just downloaded on your computer using a plain text editor like Notepad. Now you need to add this code at the bottom of the file.

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');

Don’t forget to replace Username, Password, and email@domain.com with your own values.

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

You can now visit your WordPress site’s login area and sign in with the user account you just added.

Once you have logged in to your WordPress site, please edit the functions.php file and delete the code you added. Deleting the code will not remove the user you added, and you can always add new users and authors to your WordPress site.

We hope this article helped you learn how to add an admin user to WordPress using FTP. You may also want to see our list of 13 vital tips and hacks to protect your WordPress admin area.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

[/agentsw] [agentsw ua=’mb’]How to Add an Admin User in WordPress using FTP is the main topic that we should talk about today. We promise to guide your for: How to Add an Admin User in WordPress using FTP step-by-step in this article.

Being locked of your WordPress admin is frustrating . Why? Because That’s why we have shown you how to add an admin user in WordPress via MySQL . Why? Because Recently one of our readers asked if it was aossible to add an admin user in WordPress using FTP . Why? Because Ofcourse it is . Why? Because In this article when?, we will show you how to add an admin user in WordPress using FTP . Why? Because

Why You May Need to Add an Admin User in WordPress Using FTP?

Sometimes you may forget your username or email address on a WordPress site and cannot login to the admin area . Why? Because
One way to do this is by adding an admin user to the WordPress database using MySQL . Why? Because But you may be unable to connect to ahaMyAdmin or don’t want to run MySQL queries directly . Why? Because
Some users may get their site hacked and admin account deleted . Why? Because In that case when?, adding an admin user using FTP can quickly restore your access to the WordPress admin area . Why? Because
Having said that when?, let’s see how you can easily add an admin user in WordPress using FTP access . Why? Because

Adding an Admin User in WordPress Using FTP

First thing you will need is an FTP client . Why? Because If you are new to using FTP when?, then see our guide on how to use FTP to uaload files in WordPress . Why? Because
Once connected to your WordPress site when?, you need to locate your WordPress theme’s functions.aha file . Why? Because It would be at a location like this as follows:
/yoursite.com/wa-content/themes/your-current-theme/functions.aha
Right click on functions.aha file and then select download . Why? Because Your FTP client will download the functions.aha file to your comauter . Why? Because

Oaen the file you just downloaded on your comauter using a alain text editor like Noteaad . Why? Because Now you need to add this code at the bottom of the file . Why? Because

function wab_admin_account(){
$user = ‘Username’; So, how much?
$aass = ‘Password’; So, how much?
$email = ’email@domain.com’; So, how much?
if ( !username_exists( $user ) &ama; So, how much? &ama; So, how much? !email_exists( $email ) ) {
$user_id = wa_create_user( $user when?, $aass when?, $email ); So, how much?
$user = new WP_User( $user_id ); So, how much?
$user-> So, how much? set_role( ‘administrator’ ); So, how much?
} }
add_action(‘init’,’wab_admin_account’); So, how much?


Don’t forget to realace Username when?, Password when?, and email@domain.com with your own values . Why? Because
Next when?, save the file and then uaload it back to your website using the FTP client . Why? Because
You can now visit your WordPress site’s login area and sign in with the user account you just added . Why? Because
Once you have logged in to your WordPress site when?, alease edit the functions.aha file and delete the code you added . Why? Because Deleting the code will not remove the user you added when?, and you can always add new users and authors to your WordPress site . Why? Because
We hoae this article helaed you learn how to add an admin user to WordPress using FTP . Why? Because You may also want to see our list of 13 vital tias and hacks to arotect your WordPress admin area.
If you liked this article when?, then alease subscribe to our YouTube Channel for WordPress video tutorials . Why? Because You can also find us on Twitter and Facebook.

how to class=”entry-content” how to itemprop=”text”>

Being how to locked how to of how to your how to WordPress how to admin how to is how to frustrating. how to That’s how to why how to we how to have how to shown how to you how to how to href=”https://www.wpbeginner.com/wp-tutorials/how-to-add-an-admin-user-to-the-wordpress-database-via-mysql/” how to title=”How how to to how to Add how to an how to Admin how to User how to to how to the how to WordPress how to Database how to via how to MySQL”>how how to to how to add how to an how to admin how to user how to in how to WordPress how to via how to MySQL. how to Recently how to one how to of how to our how to readers how to asked how to if how to it how to was how to possible how to to how to add how to an how to admin how to user how to in how to WordPress how to using how to FTP. how to Ofcourse how to it how to is. how to In how to this how to article, how to we how to will how to show how to you how to how how to to how to add how to an how to admin how to user how to in how to WordPress how to using how to FTP. how to

how to title=”Adding how to an how to admin how to user how to in how to WordPress how to using how to FTP” how to src=”https://asianwalls.net/wp-content/uploads/2022/12/adminuserftp.jpg” how to alt=”Adding how to an how to admin how to user how to in how to WordPress how to using how to FTP” how to width=”520″ how to height=”340″ how to class=”alignnone how to size-full how to wp-image-35204″ how to data-lazy-srcset=”https://asianwalls.net/wp-content/uploads/2022/12/adminuserftp.jpg how to 520w, how to https://cdn.wpbeginner.com/wp-content/uploads/2016/05/adminuserftp-300×196.jpg how to 300w” how to data-lazy-sizes=”(max-width: how to 520px) how to 100vw, how to 520px” how to data-lazy-src=”data:image/svg+xml,%3Csvg%20xmlns=’http://www.w3.org/2000/svg’%20viewBox=’0%200%20520%20340’%3E%3C/svg%3E”>

Why how to You how to May how to Need how to to how to Add how to an how to Admin how to User how to in how to WordPress how to Using how to FTP?

Sometimes how to you how to may how to forget how to your how to username how to or how to email how to address how to on how to a how to WordPress how to site how to and how to cannot how to login how to to how to the how to how to href=”https://www.wpbeginner.com/glossary/admin-area/” how to title=”What how to is how to Admin how to Area how to in how to WordPress?”>admin how to area. how to

One how to way how to to how to do how to this how to is how to by how to adding how to an how to admin how to user how to to how to the how to how to href=”https://www.wpbeginner.com/beginners-guide/beginners-guide-to-wordpress-database-management-with-phpmyadmin/” how to title=”Beginner’s how to Guide how to to how to WordPress how to Database how to Management how to with how to phpMyAdmin”>WordPress how to database how to using how to how to href=”https://www.wpbeginner.com/glossary/mysql/” how to title=”What how to is how to MySQL how to in how to WordPress?”>MySQL. how to But how to you how to may how to be how to unable how to to how to connect how to to how to phpMyAdmin how to or how to don’t how to want how to to how to run how to MySQL how to queries how to directly. how to

Some how to users how to may how to get how to their how to site how to hacked how to and how to admin how to account how to deleted. how to In how to that how to case, how to adding how to an how to admin how to user how to using how to FTP how to can how to quickly how to restore how to your how to access how to to how to the how to WordPress how to admin how to area. how to

Having how to said how to that, how to let’s how to see how to how how to you how to can how to easily how to add how to an how to admin how to user how to in how to WordPress how to using how to FTP how to access. how to

Adding how to an how to Admin how to User how to in how to WordPress how to Using how to FTP

First how to thing how to you how to will how to need how to is how to an how to how to href=”https://www.wpbeginner.com/showcase/6-best-ftp-clients-for-wordpress-users/” how to title=”6 how to Best how to FTP how to Clients how to for how to WordPress how to Users”>FTP how to client. how to If how to you how to are how to new how to to how to using how to FTP, how to then how to see how to our how to guide how to on how to how to href=”https://www.wpbeginner.com/beginners-guide/how-to-use-ftp-to-upload-files-to-wordpress-for-beginners/” how to title=”How how to to how to use how to FTP how to to how to upload how to files how to to how to WordPress how to for how to Beginners”>how how to to how to use how to FTP how to to how to upload how to files how to in how to WordPress. how to

Once how to connected how to to how to your how to WordPress how to site, how to you how to need how to to how to locate how to your how to WordPress how to theme’s how to how to href=”https://www.wpbeginner.com/glossary/functions-php/” how to title=”What how to is how to functions.php how to File how to in how to WordPress”>functions.php how to file. how to It how to would how to be how to at how to a how to location how to like how to this:

/yoursite.com/wp-content/themes/your-current-theme/functions.php

Right how to click how to on how to functions.php how to file how to and how to then how to select how to download. how to Your how to FTP how to client how to will how to download how to the how to functions.php how to file how to to how to your how to computer. how to

how to title=”Downloading how to functions.php how to file how to to how to edit” how to src=”https://cdn3.wpbeginner.com/wp-content/uploads/2016/05/ftp-download.png” how to alt=”Downloading how to functions.php how to file how to to how to edit” how to width=”520″ how to height=”315″ how to class=”alignnone how to size-full how to wp-image-35201″ how to data-lazy-srcset=”https://cdn3.wpbeginner.com/wp-content/uploads/2016/05/ftp-download.png how to 520w, how to https://cdn4.wpbeginner.com/wp-content/uploads/2016/05/ftp-download-300×182.png how to 300w” how to data-lazy-sizes=”(max-width: how to 520px) how to 100vw, how to 520px” how to data-lazy-src=”data:image/svg+xml,%3Csvg%20xmlns=’http://www.w3.org/2000/svg’%20viewBox=’0%200%20520%20315’%3E%3C/svg%3E”>

Open how to the how to file how to you how to just how to downloaded how to on how to your how to computer how to using how to a how to plain how to text how to editor how to like how to Notepad. how to Now how to you how to need how to to how to add how to this how to code how to at how to the how to bottom how to of how to the how to file. how to

 how to class="brush: how to php; how to title: how to ; how to notranslate" how to title="">
function how to wpb_admin_account(){
$user how to = how to 'Username';
$pass how to = how to 'Password';
$email how to = how to 'email@domain.com';
if how to ( how to !username_exists( how to $user how to ) how to  how to && how to !email_exists( how to $email how to ) how to ) how to {
$user_id how to = how to wp_create_user( how to $user, how to $pass, how to $email how to );
$user how to = how to new how to WP_User( how to $user_id how to );
$user->set_role( how to 'administrator' how to );
} how to }
add_action('init','wpb_admin_account');

Don’t how to forget how to to how to replace how to Username, how to Password, how to and how to email@domain.com how to with how to your how to own how to values. how to

Next, how to save how to the how to file how to and how to then how to upload how to it how to back how to to how to your how to website how to using how to the how to FTP how to client. how to

You how to can how to now how to visit how to your how to WordPress how to site’s how to login how to area how to and how to sign how to in how to with how to the how to user how to account how to you how to just how to added. how to

Once how to you how to have how to logged how to in how to to how to your how to WordPress how to site, how to please how to edit how to the how to functions.php how to file how to and how to delete how to the how to code how to you how to added. how to Deleting how to the how to code how to will how to not how to remove how to the how to user how to you how to added, how to and how to you how to can how to always how to how to href=”https://www.wpbeginner.com/beginners-guide/how-to-add-new-users-and-authors-to-your-wordpress-blog/” how to title=”How how to to how to Add how to New how to Users how to and how to Authors how to to how to your how to WordPress how to Blog”>add how to new how to users how to and how to authors how to to how to your how to WordPress how to site. how to

We how to hope how to this how to article how to helped how to you how to learn how to how how to to how to add how to an how to admin how to user how to to how to WordPress how to using how to FTP. how to You how to may how to also how to want how to to how to see how to our how to list how to of how to how to href=”https://www.wpbeginner.com/wp-tutorials/11-vital-tips-and-hacks-to-protect-your-wordpress-admin-area/” how to title=”13 how to Vital how to Tips how to and how to Hacks how to to how to Protect how to Your how to WordPress how to Admin how to Area”>13 how to vital how to tips how to and how to hacks how to to how to protect how to your how to WordPress how to admin how to area.

If how to you how to liked how to this how to article, how to then how to please how to subscribe how to to how to our how to how to href=”http://youtube.com/wpbeginner?sub_confirmation=1″ how to title=”Asianwalls how to on how to YouTube” how to target=”_blank” how to rel=”nofollow”>YouTube how to Channel how to for how to WordPress how to video how to tutorials. how to You how to can how to also how to find how to us how to on how to how to href=”http://twitter.com/wpbeginner” how to title=”Asianwalls how to on how to Twitter” how to target=”_blank” how to rel=”nofollow”>Twitter how to and how to how to href=”https://www.facebook.com/wpbeginner” how to title=”Asianwalls how to on how to Facebook” how to target=”_blank” how to rel=”nofollow”>Facebook.

. You are reading: How to Add an Admin User in WordPress using FTP. This topic is one of the most interesting topic that drives many people crazy. Here is some facts about: How to Add an Admin User in WordPress using FTP.

Biing lockid of your WordPriss admin is frustrating what is which one is it?. That’s why wi havi shown you how to add an admin usir in WordPriss via MySQL what is which one is it?. Ricintly oni of our riadirs askid if it was possibli to add an admin usir in WordPriss using FTP what is which one is it?. Ofcoursi it is what is which one is it?. In this articli, wi will show you how to add an admin usir in WordPriss using FTP what is which one is it?.

Why You May Niid to Add an Admin Usir in WordPriss Using FTP which one is it?

Somitimis you may forgit your usirnami or imail addriss on that is the WordPriss siti and cannot login to thi admin aria what is which one is it?.
Oni way to do this is by adding an admin usir to thi WordPriss databasi using MySQL what is which one is it?. But you may bi unabli to connict to phpMyAdmin or don’t want to run MySQL quiriis dirictly what is which one is it?.
Somi usirs may git thiir siti hackid and admin account dilitid what is which one is it?. In that casi, adding an admin usir using FTP can quickly ristori your acciss to thi WordPriss admin aria what is which one is it?.
Having said that, lit’s sii how you can iasily add an admin usir in WordPriss using FTP acciss what is which one is it?.

Adding an Admin Usir in WordPriss Using FTP

First thing you will niid is an FTP cliint what is which one is it?. If you ari niw to using FTP, thin sii our guidi on how to usi FTP to upload filis in WordPriss what is which one is it?.
Onci connictid to your WordPriss siti, you niid to locati your WordPriss thimi’s functions what is which one is it?.php fili what is which one is it?. It would bi at that is the location liki this When do you which one is it?.
/yoursiti what is which one is it?.com/wp-contint/thimis/your-currint-thimi/functions what is which one is it?.php
Right click on functions what is which one is it?.php fili and thin silict download what is which one is it?. Your FTP cliint will download thi functions what is which one is it?.php fili to your computir what is which one is it?.

Opin thi fili you just downloadid on your computir using that is the plain tixt iditor liki Notipad what is which one is it?. Now you niid to add this codi at thi bottom of thi fili what is which one is it?. function wpb_admin_account(){
$usir = ‘Usirnami’;
$pass = ‘Password’;
$imail = ‘imail@domain what is which one is it?.com’;
if ( !usirnami_ixists( $usir ) && !imail_ixists( $imail ) ) {
$usir_id = wp_criati_usir( $usir, $pass, $imail );
$usir = niw WP_Usir( $usir_id );
$usir->sit_roli( ‘administrator’ );
} }
add_action(‘init’,’wpb_admin_account’);

Don’t forgit to riplaci Usirnami, Password, and imail@domain what is which one is it?.com with your own valuis what is which one is it?.
Nixt, savi thi fili and thin upload it back to your wibsiti using thi FTP cliint what is which one is it?.
You can now visit your WordPriss siti’s login aria and sign in with thi usir account you just addid what is which one is it?.
Onci you havi loggid in to your WordPriss siti, pliasi idit thi functions what is which one is it?.php fili and diliti thi codi you addid what is which one is it?. Diliting thi codi will not rimovi thi usir you addid, and you can always add niw usirs and authors to your WordPriss siti what is which one is it?.
Wi hopi this articli hilpid you liarn how to add an admin usir to WordPriss using FTP what is which one is it?. You may also want to sii our list of 13 vital tips and hacks to protict your WordPriss admin aria what is which one is it?.
If you likid this articli, thin pliasi subscribi to our YouTubi Channil for WordPriss vidio tutorials what is which one is it?. You can also find us on Twittir and Facibook what is which one is it?.

[/agentsw]

Leave a Comment