HostAdvice - Best Web Hosting for You
  • Reviews
    • Overall Best Web Hosts
    • Cheap Web Hosting
    • Small Business Hosting
    • By Purpose
      • Blog Hosting
      • Ecommerce Hosting
      • Adult Hosting
      • Green Hosting
      • Managed Hosting
      • Email Hosting
      • Domain Hosting
      • Unlimited Hosting
      • DMCA ignored hosting
      • Offshore hosting
      • Shoutcast Hosting
    • Free Web Hosting
    • By Hosting Type
      • Shared Hosting
      • VPS Hosting
      • Dedicated Server Hosting
      • Cloud Hosting
      • CDN
      • Resellers
      • SSL
      • DDoS Protection Services
      • Website Builder
    • By CMS Support
      • WordPress Hosting
      • Magento Hosting
      • Drupal Hosting
      • Joomla Hosting
      • Fantastico Hosting
    • By Operating System
      • Windows Hosting
      • Linux Hosting
    • By Server Location
      • North America
      • Europe
      • Africa & Middle East
      • Oceania
      • Asia
    • By Scripting Language
      • PHP Hosting
      • Java Hosting
      • Python Hosting
      • NodeJS Hosting
      • Perl Hosting
      • Ruby on Rails Hosting
      • Django Hosting
    • By Database Support
      • MySQL Hosting
      • MongoDB Hosting
      • PostgreSQL Hosting
    • By Payment Type
      • PayPal
      • Credit Card
      • Bitcoin
      • Moneybookers
      • Wire Transfer
      • Webmoney
  • Tools
    • Who Is Hosting?
    • Reverse IP Lookup
    • Market Share 2021
    • Web Hosting Advisor
    • Web Hosting side by side comparison
    • Whois Lookup
    • Plans Search
    • Free URL Redirect Checker
    • Free Online SSL Checker
    • Gzip compression test
    • Site down or not
    • Compress PNG/JPG
    • Favicon generator
    • JS & CSS minifier
  • Resources
    • Resource Center
    • Hosting Guides
    • How To
    • Blog
  • Write Review
  • Hosting Coupons
USD
$United States dollar €Euro TRYTurkish lira £British pound AEDUAE dirham ARSArgentine peso AU$Australian dollar BGNBulgarian lev R$Brazilian real CA$Canadian dollar CHFSwiss franc CLPChilean peso CN¥Chinese yuan COPColombian peso CZKCzech koruna DKKDanish krone EGPEgyptian pound HK$Hong Kong dollar HUFHungarian forint IDRIndonesian rupiah ₪Israeli new shekel INRIndian rupee ¥Japanese yen LKRSri Lankan Rupee ₩South Korean won MX$Mexican peso MYRMalaysian ringgit NOKNorwegian krone NZ$New Zealand dollar PLNPolish złoty RONRomanian leu RUBRussian ruble SARSaudi riyal SEKSwedish krona SGDSingapore dollar ฿Thai baht NT$New Taiwan dollar UAHUkrainian hryvnia ZARSouth African rand
en
English العربية Български Čeština Dansk Deutsch Ελληνικά Eesti Español Suomi Français עברית 粵語 Hrvatski Magyar Bahasa Indonesia Italiano 日本語 한국어 Lietuvių Latviešu Nederlands Norsk Polski Português Română Русский Slovenčina Srpski Svenska ไทย Türkçe 中文 Українська Tiếng Việt
Link
You are in: HostAdvice How To How To Add An Admin User In WordPress Using FTP

How To Add An Admin User In WordPress Using FTP

Angela Olaru
Written by Angela Olaru
Posted on Aug. 20, 2018
Share on facebook Share on twitter Share on reddit

Due to various reasons, you might get locked out of your WordPress admin. You may forget your username and password of your site  or it may have been hacked and the current admin user account has been deleted. You want to make some changes to your site and all you can do is nothing. In this tutorial, you will learn how you can add an admin user to your WordPress site using FTP application.

Prerequisites

  • Domain Name
  • FTP Application (filezilla, cyberduck)
  • FTP login credentials
  • Text Editor (Notepad, Sublime Text)

Step 1:

Connect to your WordPress site using a FTP client like FileZilla, Cyberduck. You will need your hostname, username & password to connect through a FTP Client application. You can access these information from the cPanel of your host.

How To Add An Admin User In WordPress Using FTP

Step 2:

Once you are connected to your WordPress site from FTP client, you need to get inside your public_html directory. You will find wp_content folder. Inside the folder go inside Themes and click your current theme folder. Inside the folder you will find functions.php file.

Download this file and open it using text editor like notepad or sublime.

How To Add An Admin User In WordPress Using FTP

Step 3:

Add the following piece of code to the functions.php file  and save the file

functionwpb_admin_account(){
$user = 'Username';
$pass = 'Password';
$email = mail@example.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');

Here, You need to replace the Username, password and the email address with your own.

Step 4:

After saving the changes, upload the functions.php file to your WordPress site using FTP and replace your current file. Now you can log into your WordPress admin panel using the newly created username and password.

Conclusion

By following the above steps, we can easily create a new admin user for our WordPress site using FTP client. Once we login with the newly created username and password, we can delete the code we added in the functions.phpfile.

Check out the top 3 WordPress hosting services:

FastComet
Starting price: $2.95
9.6
9.4
9.6
9.7
9.6
Read Reviews Visit FastComet
Hostinger
Starting price: $0.99
9.2
9.3
9.3
9.3
9.1
Read Reviews Visit Hostinger
Verpex Hosting
Starting price: $2.40
9.9
9.5
9.7
9.8
9.6
Read Reviews Visit Verpex Hosting

Was this article helpful?

Submit

Related How-To Articles

  • How To Set up a VSFTPD Server on a CentOS 7 VPS or Dedicated Server intermediate
  • How to Change Your WordPress Password using phpMyAdmin newbie
  • How To Use Plesk To Install WordPress newbie
  • How to Disable PHP Execution to Improve Website's Security Using cPanel intermediate
  • How to Limit or Disable Pages and Posts Revisions of a WordPress Website Using cPanel intermediate

Best WordPress Hosting Services of April 2021

FastComet
1035 Recommended
9.6
A2 Hosting
1458 Recommended
9.3
ChemiCloud
499 Recommended
9.9
HostArmada
169 Recommended
9.9
Hostinger
1985 Recommended
9.2

Popular Posts

DevOps Toolbox: Jenkins, Ansible, Chef, Puppet, Vagrant, & SaltStack
How Much Web Hosting Storage Do You Need for Your Site?
What is SSD Storage and What Are Its Benefits in Web Hosting?
The Importance of a Good Web Hosting Service Level Agreement (SLA) When Choosing a Hosting Service
What Is the Best Country to Host Your Website?

Web Hosting Reviews

Best Web Hosting of 2021
Best Shared Hosting
Best VPS Hosting
Best Cloud Hosting
Best Wordpress Hosting
Best Small Business Hosting

Useful

  • Overall Best Web Hosts
  • Who Is Hosting?
  • Market Share 2021
  • Host Advice Blog
  • Submit Your Web Host
  • Edit your company profile
  • Write Review
  • Claim Web Hosting

FYI

  • About Us
  • Contact Us
  • Terms Of Service
  • FAQ
  • Disclosure
  • Privacy Policy
  • Human Sitemap
  • Web Hosting 101
  • Personal Data Removal Request

Follow Us

  • Be a fan on facebook
  • Read us on Twitter
  • Join us on Discord
  • RSS Feed

Company Dashboard

Hosted on FastComet
COPYRIGHT © 2021 HostAdvice.com
Regular Site

Didn’t find what you were looking for?

Our users recommend these brands

FastComet
9.6
  • Robust Security
  • Super-fast Load Times
  • 24/7 Support
$2.95 / month
Learn more
Hostinger
9.2
  • Very Low Prices
  • Incredible Speed
  • Easy Set-Up
$0.99 / month
Learn more
A2 Hosting
9.3
  • Outstanding Uptimes
  • Unlimited Storage
  • Quick Troubleshooting
$2.99 / month
Learn more
ChemiCloud
9.9
  • Excellent Support
  • Smooth Migration
  • Superb compatibility
$3.95 / month
Learn more