Using a version control system and automated deployment system is essential during WordPress theme development and administration. And when you're locked out of the WordPress admin area, adding an admin user using FTP is a quick and effective solution. In this article, we will detail how to add an administrator user in WordPress using FTP to help you regain control of your website.
![Image[1]-How to add an admin user in WordPress using FTP: Detailed Guide - Photon Flux Network | Professional WordPress Repair Service, Global Reach, Fast Response](https://www.361sale.com/wp-content/uploads/2024/07/2024070809540744.png)
When to add an admin user to WordPress using FTP
- Loss of administrator access: When you can't access the WordPress admin dashboard due to forgetting your password, a security plugin locking you out, or a plugin/theme issue, you can create a new admin user via FTP to regain access.
- Broken WordPress: When encountering common WordPress errors that prevent you from accessing the admin dashboard, creating a new admin user via FTP can help you regain control.
- security issue: If your site is hacked and the hacker gains administrator access, you can kick them out and protect your site by creating a new administrator user.
- Migration issues: When moving a site to a new server, if the administrator user is not working properly or you need to reset information, you can use FTP to create a new administrator user to solve the problem.
How to Add a New Administrator Account in WordPress Using FTP
1. Preparatory work
First, you need an FTP client software, which will be used in this article. FileZilla. After downloading and installing the FileZilla client, you need to connect to your web server. Need your FTP access details, which can usually be found in your hosting control panel (e.g. cPanel) is found in.
![Image [2] - How to add an admin user in WordPress using FTP: Detailed Guide - Photon Flux Network | Professional WordPress Repair Service, Global Reach, Fast Response](https://www.361sale.com/wp-content/uploads/2024/07/2024070809593597.png)
2. Connecting to your website
Open FileZilla, enter your FTP hostname, username, password, and port number, and click "Quick Connect". After successfully connecting, you will see the website file directory.
3. Find the functions.php file
In the right-hand window of FileZilla navigate to the public_html/wp-content/themes/your-current-theme/ folder. Find the current WordPress theme's functions.php Documentation.
![Image [3] - How to add an administrator user in WordPress using FTP: a detailed guide - Photonflux.com | Professional WordPress Repair Service, Global Coverage, Fast Response](https://www.361sale.com/wp-content/uploads/2024/07/2024070809553833.png)
4. Edit the functions.php file
right click functions.php File and select "Download" to save it to your computer. Open the file in a plain text editor such as Notepad and add the following code snippet to the end of the file to create a new administrator user:
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' );
Be sure to replace the information with your own Username,Password respond in singing email@domain.comThe
5. upload the modified functions.php file
Save the modified functions.php After the file, go back to FileZilla, find the file you just edited in the left window, right-click and select "upload" Select "overwrite" option and confirm.
![Image [4] - How to add an administrator user in WordPress using FTP: Detailed Guide - Photon Flux Network | Professional WordPress Repair Service, Global Reach, Fast Response](https://www.361sale.com/wp-content/uploads/2024/07/2024070809572633.png)
6. Access to the WordPress admin area
![Image [5] - How to add an administrator user in WordPress using FTP: Detailed Guide - Photon Flux Network | Professional WordPress Repair Service, Worldwide, Fast Response](https://www.361sale.com/wp-content/uploads/2024/07/2024070809575664.png)
Open in your browser yourwebsitename.com/wp-admin, log in using the newly created administrator account. If the code works, access to the WordPress admin area will be regained.
7. Deletion of code snippets
After logging in, open it again with the FTP client functions.php file and delete the code snippet you just added. Deleting the code does not delete the user account, it just prevents the code from being executed again.
Alternative: Add a new administrator user using the web host's file manager
If the FTP connection fails, you can use the File Manager feature in the hosting control panel. Take Bluehost as an example:
- Log in to the Bluehost Control Panel, navigate to the "Websites" tab, find the WordPress website and click "Settings".
- Scroll down to "Quick Links"section, click on "file manager".
- locate
functions.phpfile, right-click and select "compiler". - Paste the above code snippet and save the changes.
- Log in to your WordPress site with a new admin user and delete the code snippet.
Learn more about WordPress functions.php Hacks
In addition to adding a new administrator user, the functions.php The file performs many useful customizations, such as adding new widget areas or disabling automatic update notifications.
![Image [6] - How to add an administrator user in WordPress using FTP: a detailed guide - Photon Fluctuation Network | Professional WordPress Repair Service, Global Reach, Fast Response](https://www.361sale.com/wp-content/uploads/2024/07/2024070810020213.png)
summarize
With the detailed steps outlined in this article, it is possible to use FTP to quickly add a new administrator user and regain control of your website when locked out of the WordPress admin area. Whether you're using an FTP client or a file manager in your hosting control panel, the key is to perform the steps precisely and remove the added code snippets promptly after completion.
Link to this article:https://www.361sale.com/en/12925The article is copyrighted and must be reproduced with attribution.






















![Emoji[wozuimei]-Photonflux.com | Professional WordPress repair service, worldwide, rapid response](https://www.361sale.com/wp-content/themes/zibll/img/smilies/wozuimei.gif)
![Emoticon[baoquan] - Photon Wave Network | Professional WordPress Repair Services, Worldwide Coverage, Rapid Response](https://www.361sale.com/wp-content/themes/zibll/img/smilies/baoquan.gif)

No comments