Are you looking for ways to protect your WordPress admin area?
Protecting the admin area from unauthorized access allows you to block many common security threats. This can be helpful if you are seeing lots of attacks on your WordPress website.
In this tutorial, we will show you some of the vital tips and hacks to protect your WordPress admin area.
We will cover many tips, and you can use the quick links below to jump between them:
- Use a Website Application Firewall
- Password Protect WordPress Admin Directory
- Always Use Strong Passwords
- Use Two Step Verification on WordPress Login Screen
- Limit Login Attempts
- Limit Login Access to IP Addresses
- Disable Login Hints
- Require Users to Use Strong Passwords
- Reset Password for All Users
- Keep WordPress Updated
- Create Custom Login and Registration Pages
- Learn About WordPress User Roles and Permissions
- Limit Dashboard Access
- Log out Idle Users
1. Use a Firewall
A firewall monitors website traffic and blocks suspicious requests from reaching your website.
While there are several WordPress firewall plugins out there, such as Wordfence, we recommend using Sucuri. It is a website security and monitoring service that offers a cloud-based firewall to protect your website.
All your website’s traffic goes through the Sucuri cloud proxy first, which analyzes each request and blocks suspicious ones from ever reaching your website. This prevents your website from possible hacking attempts, phishing, malware, and other malicious activities.
Another great option is Cloudflare, which is what we now use on WPBeginner. For more details, see our article on why we switched from Sucuri to Cloudflare.
2. Password-Protect WordPress Admin Directory
Your WordPress admin area is already protected by your WordPress password. However, adding password protection to your WordPress admin directory adds another layer of security to your login page.
First, you need to log in to your WordPress web hosting cPanel dashboard and then click on the ‘Password Protect Directories’ or ‘Directory Privacy’ icon.
Next, you will need to select your wp-admin folder, which is normally located inside the /public_html/ directory.
On the next screen, you need to check the box next to the ‘Password protect this directory’ option and provide a name for the protected directory.
After that, click on the ‘Save’ button to set the permissions.
Next, you need to hit the back button and then create a user. You will be asked to provide a username/password and then click on the ‘Save’ button.
Now, when someone tries to visit the WordPress admin or wp-admin directory on your website, they will be asked to enter the username and password.
For more detailed instructions, see our guide on how to password-protect the WordPress admin (wp-admin) directory.
3. Always Use Strong Passwords
Always use strong passwords for all your online accounts, including your WordPress site. We recommend using a combination of letters, numbers, and special characters in your passwords. This makes it harder for hackers to guess your password.
We are often asked by beginners how to remember all those passwords. The simplest answer is that you don’t need to. There are some really great password manager apps that you can install on your computer and phone.
For more information on this topic, see our guide on the best way to manage passwords for WordPress beginners.
4. Use Two-Step Verification on WordPress Login Screen
Two-step verification, also known as two-factor verification, two-factor authentication, or 2FA, adds another security layer to your passwords. Instead of using the password alone, it asks you to enter a verification code generated by the Google Authenticator app on your phone.
Even if someone is able to guess your WordPress password, they will still need the Google Authenticator code to get in.
For detailed step-by-step instructions, see our guide on how to set up 2-step verification in WordPress using Google Authenticator.
5. Limit Login Attempts
By default, WordPress allows users to enter passwords as many times as they want. This means someone can keep trying to guess your WordPress password by entering different combinations. It also allows hackers to use automated scripts to crack passwords.
To fix this, you need to install and activate the Limit Login Attempts Reloaded plugin. Upon activation, go to visit Settings » Login Lockdown page to configure the plugin settings.
For detailed instructions, see our guide on why you should limit login attempts in WordPress. To learn more about the plugin, you can also check out our detailed Limit Login Attempts review.
6. Limit Login Access to IP Addresses
Another great way to secure WordPress login is by limiting access to specific IP addresses. This tip is particularly useful if you or just a few trusted users need access to the admin area.
Simply add this code to your .htaccess file:
AuthUserFile /dev/null
AuthGroupFile /dev/null
AuthName "WordPress Admin Access Control"
AuthType Basic
<LIMIT GET>
order deny,allow
deny from all
# whitelist Syed's IP address
allow from xx.xx.xx.xxx
# whitelist David's IP address
allow from xx.xx.xx.xxx
</LIMIT>
Don’t forget to replace xx values with your own IP address. If you use more than one IP address to access the internet, then make sure you add them as well.
For detailed instructions, see our guide on how to limit access to WordPress admin using .htaccess.
7. Disable Login Hints
On a failed login attempt, WordPress shows errors that tell users whether their username was incorrect or the password. These login hints can be used by someone for malicious attempts like brute force attacks.
You can easily hide these login hints by adding the following code to your theme’s functions.php file or by using a code snippets plugin like WPCode (recommended):
function no_wordpress_errors(){
return 'Something is wrong!';
}
add_filter( 'login_errors', 'no_wordpress_errors' );
For more details, see our guide on how to add custom code in WordPress without breaking your website.
8. Require Users to Use Strong Passwords
If you run a multi-author WordPress site, then those users can edit their user accounts and use a weak password. These passwords can be cracked and give someone access to the WordPress admin area.
To fix this, you can install and activate the SolidWP plugin. Then, you can follow the steps in our complete guide on how to force strong passwords on users in WordPress.
9. Reset Password for All Users
Are you concerned about password security on your multi-user WordPress site? You can easily ask all your users to reset their passwords.
First, you need to install and activate the Emergency Password Reset plugin. Upon activation, go to the Users » Emergency Password Reset page and click on the ‘Reset All Passwords’ button.
For detailed instructions, see our guide on how to reset passwords for all users in WordPress
10. Keep WordPress Updated
WordPress often releases new software versions. Each new release of WordPress core contains important bug fixes, new features, and security fixes.
Using an older version of WordPress on your site leaves you open to known exploits and potential vulnerabilities. To fix this, you need to make sure that you are using the latest version of WordPress.
For more on this topic, see our guide on why you should always use the latest version of WordPress.
Similarly, WordPress plugins are also often updated to introduce new features or fix security and other issues. Make sure your WordPress plugins are also up to date.
Note: Would you prefer to leave your WordPress maintenance to the professionals? Our WPBeginner Maintenance Services can take care of everything from updates to malware removal so that you can just focus on running your website.
11. Create Custom Login and Registration Pages
Many WordPress sites require users to register. For example, membership sites, learning management sites, and online stores need users to create an account.
However, these users can use their accounts to log in to the WordPress admin area. This is not a big issue, as they will only be able to do things allowed by their user role and capabilities.
However, it stops you from properly limiting access to login and registration pages, as you need those pages for users to sign up, manage their profiles, and log in.
The easy way to fix this is by creating custom login and registration pages so that users can sign up and log in directly from your website.
For detailed step-by-step instructions, see our guide on how to create custom login and registration pages in WordPress.
12. Learn About WordPress User Roles and Permissions
WordPress comes with a powerful user management system with different user roles and capabilities. When adding a new user to your WordPress site, you can select a user role for them. This user role defines what they can do on your WordPress site.
Assigning incorrect user roles can give people more capabilities than they need. To avoid this, you need to understand what capabilities come with different user roles in WordPress.
For more on this topic, see our beginner’s guide to WordPress user roles and permissions.
13. Limit WordPress Dashboard Access
Some WordPress sites have certain users who need access to the dashboard and some users who don’t. However, by default, they can all access the admin area.
To fix this, you need to install and activate the Remove Dashboard Access plugin. Upon activation, go to the Settings » Dashboard Access page and select which user roles will have access to the admin area on your site.
For more detailed instructions, see our guide on how to limit dashboard access in WordPress.
14. Log Out Idle Users
WordPress does not automatically log out users until they explicitly log out or close their browser window. This can be a concern for WordPress sites with sensitive information. That’s why financial institution websites and apps automatically log out users if they haven’t been active.
To fix this, you can install and activate the Inactive Logout plugin. Upon activation, go to Settings » Inactive Logout page and enter the time after which you want users to be automatically logged out.
For more details, see our article on how to automatically log out idle users in WordPress.
We hope this article helped you learn some new tips and hacks to protect your WordPress admin area. You may also want to see our ultimate step-by-step WordPress security guide for beginners and our expert picks of the best WordPress security plugins.
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.
Olaf
Security is simply fundamental, and the admin area is the most important part of WordPress because it controls the entire site. This makes admin-targeted hacking attempts increasingly common, which is logical given that WordPress powers tens of millions of websites. Therefore, the efforts of hackers are becoming more pronounced. This is a list of truly excellent key elements. While it may not be necessary to implement all of them, even a few can significantly enhance website security. The combination of a strong password, two-factor authentication, and limiting login attempts seems so robust that the admin area would be practically unbreakable.
Dennis Muthomi
I have experienced a hacking attempt on my own WordPress site, I particularly like the emphasis on using strong passwords and two-factor authentication. I’d like to add that regularly backing up your website is also crucial in case of a security breach.
Jiří Vaněk
I have used many of your tips and, additionally, I also changed the URL of the administration to prevent potential brute force attacks. Regarding strong passwords, I would also recommend not using the default “admin” user because it is the first user a hacker will try to attack with brute force. Personally, when I install WordPress, I never use the “admin” user but always choose a custom name. It’s a small detail, but it can also contribute to security.
Mrteesurez
I don’t think there will be a way hackers would be able to enter if one is able to implement all these tips and tricks.
I have used some, limiting logging attempt and dashboard access and they worked fine, I will still try to implement others for maximum security.
Jiří Vaněk
WordPress is a complex system, and securing the administration alone is not enough. There is always a way a hacker can attack you. They might target FTP to obtain sensitive database information, attempt to exploit a poorly protected MySQL, or try to take advantage of a newly discovered vulnerability in a plugin, theme, or WordPress itself before you manage to update it. Therefore, it is always good to think comprehensively and not forget about other elements of the system such as MySQL, FTP, and WordPress components.
Moinuddin Waheed
Must have tips and tricks for protection of WordPress admin dashboard.
I have used two factor authentication for admin login and also the login limits for admin access.
dashboard protection is of utmost importance as it can have serious repurcussions if dashboard gets compromised.
I didn’t know that we can have these much steps to protect our dashboard.
Thanks for the exhaustive lists of tips for dashboard protection.
WPBeginner Support
Glad to hear you found our list helpful!
Admin
Theo
“This plugin has been closed as of November 23, 2020 and is not available for download. This closure is permanent.”
I know that this is a 3 and a half years old article!
It would be nice if someone could suggest an alternative! Thank you for your time!
WPBeginner Support
We will certainly take a look at alternatives.
Admin
Raksa Sav
If I add someone as an administrator of WordPress, can they remove from administrator or stole my WordPress site?
WPBeginner Support
Hi Raksa,
Yes, they can remove other administrators and take control of your website.
Admin
Muchsin
I want to ask
I have tried the tutorial directory privacy on this article and it runs smoothly but there is one problem that is when I try the search feature located in the navigation menu on my website as a user and always asked to fill in the username and password of that directory. Then how do I solve the problem?
I use the newspaper theme from tagdiv.
sherizon
what is the best advice in starting up an eceommerce website can i use wordpress?
WPBeginner Support
Hi Sherizon,
Yes you can. Please see our guide on how to start an online store.
Admin
Brenda Donovan
Good hints and tips here. Does is matter where in the functions.php file one puts the block hints script? Just add it to the bottom?
WPBeginner Support
Hey Brenda,
Yes, you should add it to the bottom.
Admin
Joe
Another really helpful means of protecting your WP site is to use a login that is NOT ADMIN and not your email address. Use a unique login name like WP@#% or something crazy like that.
Dragos
You should also change where you install the default folder of wp-admin.
Abhinav S Thakur
Can anyone fix this?
How shall I force SSL only for admin and rest of the site should be http.
Like wp beginner has non SSL site!
Running wordpress, cPanel
Pinkey
Hi,
I just started a content based website and unfortunately my site got hacked. Please advice us with suitable solutions (software/certificates etc) to avoid any future hacks being done.
Thanks & best Regards,
Pinkey
Lucy Barret
The tips that you added are so helpful. But for securing WordPress, you need to give more emphasis to the security of your login area. You need to pay more attention on strengthening your admin login area.
John
Any idea why deleting wp-login.php does not prevent brute force attacks? I thought it was a quick fix for a site that only requires my login, therefore only replace the file when needed?
Help please!
Craig
Great advice apart from the removal of admin messages, if you’re lessening the user experience because of security then you’re not doing it right.
Tahir
smart collection….!!
Talha
Thanks a lot. I have a website . I will set up there.
Pat Fortino
This plugin no longer exists: Stealth Login
Can you recommend an alternative?
Thanks
Lori
I’ve also been told to “remove links to the admin page from the site so that the hacking robots can’t just follow a link.” I’m not sure what this means, or how I would do it… Anyone know what this means and could point me to step-by-step directions to do so?
(I don’t see links to an admin page anywhere on my website, nor do I remember there ever being any. The only way I access the admin page is by going to the /wp-admin address.)
Emily Johns
Great information!
For non expert bloggers and coders, I suggest installing a WordPress plugin, to make things easier.
From the ones you mentioned, I found “Wordfence Security” plugin a free solution to secure blogs and make them faster.
Tested and happy with it!
Barry Richardson
I was under the impression that the original username (e.g. “admin”) of a WP site cannot be deleted, so even if we did add a new username, the original “admin” would still be available for a potential hacker to exploit.
WPBeginner Support
If you create a new user account with the administrator role, then you can safely delete admin user.
Admin
Sandeep Jinagal
Hyy WPBeginner first of All u are Doing Best OF Best???
And m want to Know m Want to Set my login Page Like urs. bcoz when m trying to open ur login page. it shows a popup for login. can u give me that tool.
WPBeginner Support
Please see our guide on how to password protect WordPress admin directory.
Admin
Kheti
Thanks for this educative material. Very helpful. Thanks for the good work and support.
ifaheem
great article but needs to be updated. There are a few great plugins which do all of the above task by one plugin install!
My site was under heavy attacks, fake google bot were always there. I noticed up to 300 Hits from a single IP. the most visited area was wp-admin
After performing above steps (update them by some research), feeling secure a little.
Don’t Install a plugin without reading Min. of 5 reviews. They tell you the truth (Go for a bad review and see what he/she says; they have suffered something bad!
Prince Jain
Thank you for such a great post.
But please update that Stealth Login Plugin do not create customize URL for Login Window, instead it add up an authorization code below username and password at login window of Wordpress.
Also can you please suggest a plugin to create custom URL for login window.
Mitchell Miller
Stealth Login was removed from WP Plugin repository.
But changing wp-login.php link is the first step to protecting a WordPress site.
laya rappaport
What happens when you give your login details to someone to work on your website and they change the login details so you can no longer access your word press account?
James Campbell
I’m not sure if there’s a way for you to retrieve your sites information necessarily, but if you’re able to, always create a new user and give other people access through that particular user. This allows you to restrict access to certain areas and you can also delete their access when it’s no longer needed. Giving up your access to your site let’s them block you out.
Lisa Wells
If someone’s changed your WordPress user information, hopefully you can still login to your database through, say phpMyAdmin. From there you should be able to create a new admin user directly in the tables:
https://www.wpbeginner.com/wp-tutorials/how-to-add-an-admin-user-to-the-wordpress-database-via-mysql/
user4574
One other helpful item not mentioned is database permissions. The Wordpress db user generally doesn’t need to be granted all permissions. In the vast majority of cases it only needs ALTER, CREATE, CREATE TEMPORARY TABLES, DELETE, DROP, INDEX, INSERT, LOCK TABLES, SELECT, UPDATE.
So if you’re doing it directly in mysql, it would be:
GRANT ALTER, CREATE, CREATE TEMPORARY TABLES, DELETE, DROP, INDEX, INSERT, LOCK TABLES, SELECT, UPDATE ON .* TO ”@’localhost’;
If doing it in cPanel or whatnot, just tick the appropriate boxes when granting permissions to the db_user.
Tanmoy Das
Awesome tips for any newbie ! I want to always change the login URL but dont know how to do it. Thanks for those tips.
Derick
@Daniel: Hackers now have a tool that enumerates/lists all your usernames including the roles of these, so doing that would not trick the hacker at all.
Thorir
Just installed the Limit Login Attempts plugin on my WP sites. On one of it I almost instantly noticed a lock out, it was also the only install that was in root. All the others are in a subdirectory and several hours later none of them have registered a lock out.
Perhaps this is a helpful factor, security wise?
Mary
Hello, I hope you are well!
This was a great article but a little complicated for me.
because I need the easy way right now, the wordpress firewall plugin looked good but
my fear is losing my login page.
I have spent a long time trying to work with FTP and have not been able to understand it.
Will this be a good plugin for a scaredy cat?? Thanks Mary
Ed van Dun
And what about Bullet Proof Security? It covers some area’s mentioned above and quite a few more.
Prodip
All of the above tips helped me to make my blog with more secured.
Dr. Sean Mullen
This is great info but Please update! Thanks
Guest
I know this article is from way back in ’09, but can you do an updated one, since a lot of these plugins are no longer “officially” compatible with the latest WordPress (3.4.x-3.5)?
Editorial Staff
Yes, it is in the works along with few other things. We are doing the best we can. Thanks for letting us know.
Admin
whoiscarrus
Just really getting into WP development and can’t say thank you enough! These are great for beggin’n folk like myself!
abhizz
amazing tips about wordpress thank you
Bigdrobek
Great turitorial, but please can you update it?
Few plug-ins is not exist, are old or are hidden by WordPress.org.
– Stealth Login
– Login Lockdown
– Admin SSL
I am interested in step 1)Create Custom Login Links – do you have tip for new plugin which do similar job?
Faizan Elahi ( BestBloggingTools)
This is a great resource. Thanks
mattjwalk
You could also add to the list, “use second factor authentication” instead of standard passwords. There is a new website authentication method https://www.shieldpass.com where you buy cheap access cards and then install the WordPress plugin. You then place your card onto the screen to see the dynamic login numbers instead of a static password. It is unique in also being able to encode transaction digits for mutual authentication which stops attackers man in the middle tactics, even one with access into your laptop or mobile.
Jermaine
The issue I have with No: 6 is dynamic ip address, you get locked out every time your ip address changes what the workaround?
Editorial Staff
You can add custom login if the IP doesn’t match.
Admin
vivek
great post and nice guide for new bloggers like me
fareed
Great post and very useful to me thank you
Daniel
Hacker will think he is successful when he logs in with admin username and finds that the role has been set to ‘subscriber’. Isn’t this another form of added security. I don’t want to delete my admin because i put messages etc in forums and the blog and like my users to know that it’s from administration. as well as i use my regular username!
Jonathan K. Cohen
This article needs to be revisited. A number of the plugins suggested have not been maintained, and may be incompatible with the latest version of WP.
These include #1, #3, and #5.
John
For #1 ckeck this plugin called WPS Hide Login
Greg
I completely agree with you. I’ve been using the Limit Login Attempts plugin for my WordPress for a while. Today this plugin is outdated. I’ve switched to WP Cerber:
Danang Sukma
Thanks for your post.
Im using password protect for my wp-admin folder in cpanel, is it enough?
mby
uh what a useful info guys, it can help surely!!
thanks for posting! ^_^