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.
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! ^_^
anthony
This is great information which I will be implementing ASAP!I have already experienced having my blog hacked so have been worried about these issues.Many thanks!!
shoaib hussain
man m moving from one post to the other in your blog and m loving it it.thnx a lot.guess i’ll have to subscribe now.
tzutzu
AWESOME post!! Thank you for this info
Marlin
Thanks Nice list this will surely help to secure wordpress admin panel.
Abhilash Thekkel
Very useful tips. Thank you
Jessica
I’m currently learning wp development. I want to make a ecommerce site with wordpress using the WP e-Commerce plugin. Does anyone know if these tips will keep my ecommerce site secure.
Editorial Staff
Make sure that you have SSL Protection on your e-commerce site for all transactions. These are only to protect your admin area.
Admin
Ursula Comeau
Wow – this is an AWESOME post! Thank you so much for sharing all this information – and some great plugins as well!
In a world where security has become top priority, these are very important things to be aware of with a WordPress installation. Really appreciate your transparency and willingness to share this information! I’ll be tweeting this one.
Lilia
The problem with plugins is that they’re not always compatible with every version, and they aren’t always updated.
Editorial Staff
Most plugins are compatible with newer versions, and if the developer decides to leave development of the plugin, others often pick up and create a plugin with fixes for the future releases. You just have to stay active in the community.
Admin
Smashing Themes
Seriously guys, change your site name to WP ROCKER, you guys rock hard. I installed three plugins to protect my admin panel after reading this great post.
Dagmar
There are also some paid plugins – i.e. “WP Secure” which also claims it is going to make your WP secure from hackers. It also works on the summary of couple of the principles above – i.e. custom made login page, one IP confirmation etc.
Is it worthy to purchase? = anybody knows if it is easier to use for non-techie than some of the above mentioned?
Editorial Staff
If you can do the work for free then what is the point in paying?
Admin
iHacks
Link to WordPress Firewall Plugin?
Editorial Staff
It is working now.
Admin
Kjetil
Hi
Thanks a lot for your tips.
Regarding tip 8, I wonder how to insert the code
`add_filter(’login_errors’,create_function(’$a’, “return null;”));`
What is the complete function to use?
I’d like to try since I already use AskApache Password Protect and that plugin is incompatible with Secure Wordpress.
Thanks,
Kjetil
– http://www.dolcevita.no
Editorial Staff
You go to functions.php and insert that code. Thats all if we understand your question clearly. If this has not answered it, then please reply to the comment and we will surely take a look at it.
Admin
Robinoz
Thanks for this invaluable information. I’ve just suffered a malware attack that put my blog off line for a day or two while I had my Wordpress programmer sort it out. Ver inconvenient.
I’ll be implementing some of the suggestions you’ve made in the next day or so.
Robinoz
http://www.e1jobs-blog.com (All About Jobs blog”
secure server
good tips for securing wordpress. as time goes we are going to see hosts either become more stringent and secure or cms packages need to implement on install a few more security initiatives.
abbie
Hi. You’ve written a very good post.
I’ve rewrote this great post in Indonesian language.
I really hope you dont mind.
Editorial Staff
We have sent you an email regarding this. We do not allow full article translation. Please summarize it and link to our article if your users want to read the full tips.
Admin
abbie
Thanks for your response.
I’ll revise my post.
Arie
Hi there..
I want to ask something for you.
Besides i has to use askimet, captcha word, storng psswrd, is any other way for hacker to sabotage our web.
Thats my question, please repp to my mail
Regards,
Arie
Editorial Staff
Yes, if your host has vulnerabilities, then the hacker can get you down as well.
John Macpherson
It took me a few minutes to work this one out but you have the wrong kind of quotes around this function
add_filter(’login_errors’,create_function(’$a’, “return null;”));
It should be:
add_filter(‘login_errors’,create_function(‘$a’, “return null;”));
Other than that, great post.
jakesjohn
What you can from Wp-PreventCopyBlogs Wordpress Plugin
1.Track the visitors who try to copy your content.
2.Record the ip of the user who tries to do fraudulent copy with their landing url of your site and referral url.This can help you to do necessary measures if you notice something bad.
3.Enable Message displayed to your user upon user’s choice.
4.Disable Selection of you text and Right Click for users depending on the option.
Srecko Bradic
I must congratulate with this excellent article!!! To be honest I know for some tips but some very important info was unknown for me until now!
Keep on good work
Soxialize
Excellent post! Will be testing several of the security tips you provided. Thanks for putting all this together!
Heather
Brilliant post, I think I’ll sleep better tonight!
Henry
Regarding #6, if you use the following .htaccess file you will be able to login from other locations in a two-step process. This requires you to add a htpasswd file (read your server documentation).
AuthUserFile ‘some htpasswd file’
AuthGroupFile /dev/null
AuthName “WordPress Admin Access Control”
AuthType Basic
order deny,allow
deny from all
Require valid-user
# whitelist Syed’s IP address
allow from xx.xx.xx.xxx
# whitelist David’s IP address
allow from xx.xx.xx.xxx
# whitelist Amanda’s IP address
allow from xx.xx.xx.xxx
# whitelist Muhammad’s IP address
allow from xx.xx.xx.xxx
# whitelist Work IP address
allow from xx.xx.xx.xxx
Satisfy Any
The “require valid user” and “satisfy any” lines will force the Apache Server to request a Username and Password before you can access the WordPress Login screen. Please DO NOT use the same Username and Password in the htpasswd file that you use for your WordPress access, or you will defeat the purpose of the extra level of security.
Editorial Staff
Thanks for the suggestion. Post updated with a link to this way as well
Admin
Laura
Thanks for the great article. I’m looking forward to making my own blog more secure.
A.rnaud
I just made a French translation of your article on my blog (http://bit.ly/19V6YU)
thanks for the tips !
Editorial Staff
Thanks for the translation
Admin
Constantine
Hi, I have been blogging for 3 years. My blog got hacked in June 2009 and google banned for 30 days, my pageviews immediately slide from 800 a day to less than 100 a day.
I highly recommend installing wordpress firewall plugin. The plugin will send your an email every time someone tries to hack your blog together with the hackers IP address. The plugin detects and blocks strange requests, redirecting the attack to the homepage.
On monday i got an email of six attempted hack attempts over the weekend. The hacker tried the admin page three times when that failed he tried searching wordspew plugin which i dont use.
To all newbies good luck
Editorial Staff
Thanks for suggesting this one. Its now added in the post
Admin
Renee Fischer
Once a hack is successful the bot or human hacker will keep your data and keep retrying your website files looking for a way back in. they will continue to be relentless. if they have happened to hack your email or computer or server they will keep going until they have hacked everything you touch. they are like cockroaches that found crumbs that led to your house.
Dirk
In reality 2., 7. and 11. (if not hardened) are the most important things. The other things are nearly unnecessary
Typhoon
Real a very useful article. I tweeted it.
By the way I want to ask one thing; How does Stealth Login works for guest authors?
Editorial Staff
You give them the special URL that you created if you trust them enough. For the most part, guest authors should not even be allowed in the admin panel unless they are authors of your site. If someone has written multiple posts for your site then they can be trustable so you can give them the special url /login or /googlogin or whatever you created.
Most top blogs take guest posts via email and if those guest authors become regular authors, only then they are allowed in the admin panel.
Admin
Misao
Thank you! Very helpful article. I will try your tips and hacks on some of my blogs.
sriganesh
very useful. :geek: thanks for sharing. i will spred this surely
Yves
Hi
Nice list! You may want to add the nice “One time Password” plugin for Wordpress:
http://wordpress.org/extend/plugins/one-time-password/
quicoto
Thanks for the tips
Tim
Great tips.
For the involved readers there is an inaccuracy in #6.
“The downside to this hack is that if you ever want to access the admin panel from some other place, you won’t be able to do so unless you add that extra IP in your .htaccess file.”
If the ip-address you allow is a box you can can SSH into, you can SSH tunnel through it (I use foxyproxy, because it makes the switch very easy). Also, if you are using nginx instead of apache you can evaluate the URI w/ regular expressions to block everything from wp-app.php to wp-trackback.php (or selectively choose which ones you do not want to block). I cover this @ http://www.phrison.com/securing-arbitrary-uris/ but it is not for the unexperienced.
I have a large collection of tin-foil hats.
Editorial Staff
You are correct.
Warning: New users don’t try this at all. This is for experienced users only.
Admin
SaigonNezumi(Kevin)
Thanks for this piece. I have been waiting for an article like this. Adding a couple of your tips will help secure my WP sites.
Thanks again.
Editorial Staff
You are welcome Let us know which one you use and your thoughts on the process of implementing it.
Admin
Dana DeFazio
I’m wondering if there is something comparable for my blog because it is a WordPress.com site and also I have a new blog at danaddiamond.BlogSpot.com
Editorial Staff
WordPress.com does not allow you to have a lot of privileges but with their server, you are safe for the most part.
Admin
Tinh
Excellent tips and hacks, I only applied 6 of 11 tips you suggested, let me try the rest
Jo
This site is a happy new find for me (FYI,thanks to @Problogger on Twitter), and I’m looking forward to further exploration. This article is the kind of tight, clear writing that is too rare these days. Thanks for some genuinely helpful information.
Editorial Staff
We are glad that you like our site, and we are also very glad that Darren found the article useful enough to tweet it. We hope you follow us on twitter so you can stay up to date with all the nice tutorials.
Admin
Marc
Wow – I’m fairly new to WP and had no idea there were so many gateways for hackers. I’m sure they won’t find their way in after adding a few of these.
Thanks.
Roger Duck
WordPress security is a growing issue and these steps are critical for securing a WordPress site. Beefing up security helps the entire community as well as your own site to take time to implement these ideas. Well done.
Rob
And to protect all your hard work / security features from your clients….
http://wordpress.org/extend/plugins/hide-admin-panels/
James Morrison
A good list of vital tips to secure your site. I particularly like #8 I’ve never done this before but will from now on!
Regarding #7 – Remove ‘admin’ username:
I don’t remove the admin username, I create a new admin account then change the ‘admin’ users account type to subscriber.
That way, even if someone does crack the password it’s a useless account. If you remove it, someone can register that username…
Kathlene
Qwerstion for James Morrison. Can you explain a bit more what you are saying and how to do it?
For the staff, I have tried a number of times to get a number for the akisnet plugin and cannot seem to come by one. How is one obtained.
Very nice post. I will be implementing these directly. I had one of my blogs hacked twice in 30 days once.
Thanks for the great info.
James Morrison
Follow these steps:
1.) Create a new user account with admin access (eg ‘James’)
2.) Sign in with new account to WP Admin
3.) Edit ‘admin’ users’ account and change access to subscriber
That way if someone tries to compromise the admin account and succeeds they still can’t do anything bad to your site.
To get an akismet key you need to sign up for one at http://www.wordpress.com
Hope this helps!
Mathdelane
You can always change the default “admin” username to anything you wish via phpMyadmin database. Here’s my post about it as well as my experience about blog hacking and security:
http://softwarecritics.info/open-source/blogosphere-alert-prevent-your-wordpress-blogs-from-being-hacked/
Cheap Sites
Thank you for all the suggestions, I’m working on a few big projects and this will certainly help once the blogs are up and running.
First time here and I’m loving the blog, good job!
Dan
Editorial Staff
Glad that you like it here. Feel free to make any suggestions if you ever have a question, or would like some specific topic covered at WPBeginner.
Admin
Flow Interactive
Good tips. You can also move your wp_config.php file outside of the web root to provide an extra layer of security.
Editorial Staff
Yes you can do that, but in this article we were only talking about WordPress Admin Panel not the entire site in general. There are many other ways to protect your site entire WordPress blog.
Admin
Shabayek
But what if you allow your blog visitors to register, and force them to log on before posting comments?
Editorial Staff
Then you cannot use the IP protect and others, but you should still use limit lockdown, not use admin username, and semisecure login.
Admin
Gerald Weber
I use the limit loggin requests to my ip address. This mean that anyone that attempts to access http://www.domainname.com/wp-admin that is not making the request from my ip address will simply get a 404 page.
Blogspot to wordpress
Hey very useful post.
MOst INteresting IDeas blog
Useful post for my blog.
Dreyer
A helpful list. Will be giving these a go. Better paranoid than sorry.
Rafi
Hey this is a wonderful collection of tips and hacks, very useful. I recommend every WP blogger to go through the list and follow the steps as well as any other useful resources available elsewhere. After all we have NOT set up our blogs so someone shall take control of our lives. Damn.
Thanks for sharing, WPBeginner.
Sergej Müller
Link to WordPress AntiVirus Protection?
Editorial Staff
No matter how much you proofread, some thing are always missed. Glad we have users like you. Link added. Thanks again.
Admin
Lolic
What about aksimet and captcha systems?