· 6 min read · Mert Tati
How to Change the WordPress Login URL and Hide wp-admin and wp-login.php (2026)
What does changing your wp-admin and wp-login.php URL actually fix? Secure your WordPress login with XML-RPC, username, rate-limit and 2FA fixes.
Short answer: changing your WordPress login URL (hiding wp-login.php and wp-admin) turns away most automated bots, but on its own it isn't enough. You also need to deal with XML-RPC, a second door that does the same job, close the endpoints that leak usernames, set up login rate limiting, and turn on two-factor authentication (2FA) for administrators. This guide walks through all four, in order.

Why does everyone attack wp-login.php?
Every WordPress site in the world has the same login URL: yourdomain.com/wp-login.php or yourdomain.com/wp-admin. Bots don't need to know anything about your site; they scan the internet for WordPress installs, hit that address and try passwords from leaked credential lists. Even when these attempts fail, each one runs PHP and database queries, strains your server and fills up your log files.
1. Move the login page to a secret path
The first step is moving the login to an address only you know (for example yourdomain.com/team-login). Requests to the old addresses should get a 404 page or be redirected to the homepage. A properly implemented login hide doesn't break any of the following:
- admin-ajax.php and the REST API: themes, forms and WooCommerce cart actions rely on them.
- WP-Cron and scheduled tasks.
- Form and payment flows that run through admin-post.php.
- On-site “Log in” and “Lost your password?” links: all of them should automatically point to the new address.
The biggest risk is locking yourself out. If you forget the new address, or a caching plugin keeps serving the old page, you won't be able to reach your dashboard. That's why the solution you use must let you override the login path with a single line in wp-config.php. Hushfort does this with the GATEKEEPER_LOGIN_SLUG constant, and when the login path field is empty, hiding doesn't kick in at all.
2. Disable XML-RPC: why do attacks continue after you hide the login?
xmlrpc.php is a separate login door WordPress keeps around for legacy apps and remote publishing, and it accepts a username and password with full privileges. Hiding the login page doesn't close this door. On top of that, the system.multicall method lets an attacker try hundreds of passwords in a single request, and a login page rate limit often counts that request as just one attempt.
We saw this firsthand with one of our clients: on the West Riders Custom store, password attempts kept coming even though the login URL was hidden. The logs showed that every single attempt was coming through xmlrpc.php. The fix was to disable XML-RPC logins; harmless features like pingbacks can stay on, but multicall and any method that accepts a password should be shut off. If you don't use Jetpack or an old mobile app, disabling XML-RPC entirely is also a safe choice.
3. Plug username leaks
Half of an attacker's job is finding a valid username, and by default WordPress hands it over in several places:
- REST API: yourdomain.com/wp-json/wp/v2/users lists users to visitors who aren't logged in.
- Author enumeration: a request to yourdomain.com/?author=1 redirects to /author/username/.
- Sitemap: wp-sitemap-users-1.xml publishes a list of authors.
- oEmbed: post embed data includes the author name.
- Login error messages: different messages for “This username is not registered” and “Incorrect password” reveal which usernames are real.
Close each of these individually and reduce login errors to a single generic message. Then run your own check: if your username is the same as your public display name, every post you publish is showing your username. Change the display name on your profile screen.
4. Set up rate limiting and alerts

A secret URL can leak someday too. Counting failed logins per IP, locking out after a set threshold, applying longer lockouts to repeat offenders and getting an email when a lockout happens closes that gap. The key is counting the right IP: if your site sits behind Cloudflare or another proxy, the address your server sees belongs to the proxy, not the visitor. A misconfigured limit will either lock out all your visitors together or lock out nobody. The opposite is also a vulnerability: reading the IP from a request header without validation lets an attacker send a fake IP with every attempt.
5. Two-factor authentication (2FA) for administrators
Even if a password leaks, 2FA is the most effective way to protect the account. A method that works with TOTP apps like Google Authenticator is enough; you don't need SMS. Watch three things during setup: the QR code should be generated on your own site (not sent to an external service), one-time recovery codes should be downloaded and stored in case you lose your phone, and there should be a way to disable 2FA through wp-config.php in an emergency.
Checklist
- The login URL has been moved to a secret path, and the old addresses return 404.
- An emergency login path can be defined in wp-config.php, and that information is stored somewhere safe.
- XML-RPC logins and system.multicall are disabled.
- /wp-json/wp/v2/users and ?author=1 reveal nothing to logged-out visitors.
- Login error messages are generic.
- Rate limiting is on and counts the correct IP behind Cloudflare or a proxy.
- 2FA is enabled on every administrator account, and recovery codes are stored.
- Usernames and display names are different.
Doing it all with one plugin
You could install a separate plugin for each of these steps, but plugins that don't know about each other calculate the same IP in different ways, keep separate allowlists and conflict. After incidents on our own sites and client projects, we at Tati Creative built the Hushfort WordPress security plugin to bring all of these steps into a single panel. The login hiding, rate limiting and alerts, 2FA and attack surface reduction modules share the same IP detection and the same activity log. Its Surface Scan checks your site with real requests and shows you leaked usernames by name.
Frequently asked questions
Does changing the login URL affect SEO? No. wp-login.php and wp-admin aren't pages that should be indexed by search engines, and they're already set to noindex by default.
I use a caching plugin. Will that cause problems? The login page should never be cached. In plugins like LiteSpeed Cache or WP Rocket, add the new login path to the cache exclusion list and purge the cache after making the change.
What happens if I forget the new URL? You can define a new path by adding the emergency login constant to wp-config.php via FTP or your hosting control panel. If your solution doesn't offer this, renaming the plugin folder is the last resort.
How will my WooCommerce customers log in? Customers log in from the “My Account” page, which doesn't depend on wp-login.php and isn't affected by hiding it.
Bottom line: hide your login URL, but don't stop there. Disable XML-RPC, plug username leaks, set up rate limiting that counts the correct IP, and enable 2FA for every administrator. And prepare an emergency login path in advance so you never lock yourself out.