Web Development

WordPress Login Security: Two-Factor Authentication, Login Limits and XML-RPC Explained for Small Business Sites

What the WordPress Handbook recommends against login attacks: two-factor authentication with the Two Factor plugin, a safe rollout order, login limits at the host or firewall, XML-RPC, application passwords, and what to do if you are locked out.

zabil

7 min read
A rusty chain and small brass padlock fastened across the rings of an old studded wooden door

If you run a WordPress site, your login page is open to the whole internet. Anyone, or any script, can try a username and password there. Most small business owners only think about this after a scare. This guide explains what the WordPress Handbook recommends, how to add two-factor authentication without locking yourself out, and which popular tricks are not worth your time.

It is based on the WordPress Handbook pages on brute force attacks and two-step authentication (both last updated 14 October 2026) and the Two Factor plugin page, all read on 6 December 2026. We also checked the WordPress 7.1.5 files on our server. Where a point is our own suggestion, we say so. This is general guidance, not a security audit of your site.

What a login attack looks like

The Handbook describes it simply: “A brute force attack is the simplest way to break in: an attacker repeatedly tries username/password combinations until one works.” These attempts are automated and often come from many machines at once, so even failed ones can flood a site with requests. It is not only a WordPress problem, but WordPress is popular enough to attract it.

The Handbook’s short list

In summary, the Handbook suggests strong unique passwords with a password manager, two-factor authentication for administrators, rate limiting at the edge or on the server, a challenge such as Cloudflare Turnstile or reCAPTCHA on the login form, restricting XML-RPC if you do not need it, keeping WordPress, themes and plugins up to date, and watching for unusual login activity. The rest of this guide takes those in turn, in the order we would do them.

Step 1: add two-factor authentication

Two-factor authentication (2FA) means a password alone is not enough. The Handbook’s page says WordPress core does not include it: “As of 2025, WordPress core does not ship 2FA; it must be added via a plugin or SSO/IdP.” We looked through the WordPress 7.1.5 files and found no 2FA feature either. It recommends turning it on for “all administrators and privileged users”.

One option is the Two Factor plugin, listed as by WordPress.org and described as a community plugin. When we read the page it showed version 0.17.0, more than 200,000 active installations and testing up to WordPress 7.1.5. Its methods are:

  • Authenticator app (TOTP): the plugin marks this as recommended. You scan a QR code with an app such as Google Authenticator, Authy or 1Password.
  • Backup codes: also marked as recommended. These are one-time codes for emergencies.
  • Email codes: one-time codes sent to the user’s email address. The plugin rates this method as medium security.
  • A dummy method for developers, which only appears when debugging is on. Do not use it.

The Handbook adds that “Unfortunately, SMS is not a secure communication channel”, so we would pick an app over text messages. It also notes the drawback: if someone forgets their phone, they can be locked out.

Two limits are worth knowing. Each user sets up 2FA in their own profile, and the plugin says “there are no built-in enforcement settings”, so it cannot force everyone to do it. And passkeys and hardware keys are not built in; the plugin points to a separate Two-Factor Provider: WebAuthn plugin for those. The Handbook says passkeys give phishing-resistant, passwordless login and suggests enrolling “at least two authenticators per admin”.

How to roll it out without locking yourself out

This order is our suggestion:

  1. Take a fresh backup first. Our guide on WordPress backups explains how to check you can restore it.
  2. Install the plugin and open your own profile. Set up the authenticator app.
  3. Generate backup codes and store them in your password manager. The plugin says: “Always enable backup codes to prevent being locked out of your account”.
  4. Log out, then log in again in a private window to test the whole flow.
  5. Only then ask each other administrator to do the same, one at a time.
  6. Choose one 2FA plugin and stay with it.

Step 2: slow down the guessing

2FA protects the account. It does not stop the requests. The Handbook says a security plugin can limit login attempts if your host or CDN does not do it, but those plugins “still execute within PHP and thus consume some resources under heavy attack”. It prefers limits applied before the request reaches WordPress.

It also says a managed firewall, whether Cloudflare, Sucuri or your host’s own, can filter known bad addresses, challenge suspicious visitors and rate limit the login and XML-RPC addresses. So our suggestion is to ask your host two questions: do you rate limit wp-login.php and xmlrpc.php, and can you show me where? If the answer is no, a login-limiting plugin or a Turnstile challenge is a reasonable fallback. If you use Cloudflare, our guide on CDNs and Googlebot covers one thing to check. Our post on form spam and Turnstile explains the challenge itself.

Step 3: decide about XML-RPC

XML-RPC is an older way for apps to talk to WordPress. The Handbook says the xmlrpc.php address is a frequent target for password guessing and advises disabling it if you do not use it, or restricting and rate limiting it if you do, for example for Jetpack or a mobile app. Ask your developer whether anything of yours needs it before switching it off.

A detail from the WordPress code: its own comment says the xmlrpc_enabled filter only controls whether XML-RPC methods that require a login are enabled. It “does not control whether pingbacks or other custom endpoints that don’t require authentication are enabled”. So that one setting is not a full off switch. The Two Factor plugin also documents a filter that limits REST API and XML-RPC logins to application passwords.

Step 4: tidy the accounts

  • Retire the username admin. The Handbook says “Do not use the username admin.” Our steps: create a new administrator, log in as it, then delete the old one. WordPress asks what to do with its content; choose to attribute it to another user.
  • Fewer administrators. The Handbook says to limit the number and to use least-privilege roles for everyday work. If an editor can do the job, do not make them an admin.
  • Application passwords for integrations. These came in with WordPress 5.6, and by default they are available on sites using HTTPS. The Handbook says they can be revoked without changing your own password.
  • Remove old users. When a freelancer or agency finishes, remove their user too. Our guide to giving and removing agency access has a checklist.
  • Passwords. Our WordPress security checklist covers password managers and keeping plugins updated.

What not to rely on

The Handbook says “Obscuring the login URL can reduce noise but should not be your only defense.” It also says “Avoid permanent country blocklists. They can block legitimate users and are difficult to maintain.” That matters if you or a team member log in while travelling. It describes older advice such as heavy .htaccess rules or password-protecting the whole admin folder as unreliable or likely to break plugins.

If you are locked out

  • Use one of your backup codes.
  • Ask another administrator to open your profile in Users, then All Users, scroll to Two-Factor Options, untick the methods and save. The plugin describes this and says it lets you log in with your password alone.
  • If you have command-line access, wp two-factor disable <user> resets a user’s 2FA.
  • If every administrator is locked out, our guide to the WordPress critical error and recovery explains how to pause a plugin from the file manager.

After you regain access, set up 2FA again and make fresh backup codes.

If you think someone already got in

Change passwords, check the Users list for administrators you do not recognise, and follow our guide to a hacked WordPress site. Keep automatic updates in mind too, because a stolen password is only one way in.

If you would like help with this, tell us about your business or read about our systems and technology service.

Related work

Where this has been applied.

ITH - SodraTech

Institutions & Organisations

Admission ITH

Institut Teknologi BJ Habibie

A student admissions platform handling the full registration process online, from application through document upload to initial payment.

View Project
Kalimporo - SodraTech

Institutions & Organisations

Desa Kalimporo

Desa Kalimporo

A village profile platform presenting governance structure, population data, local potential and village programmes to a wider audience.

View Project

Tourism, Hospitality & Rental

Sarfaraz Rent Car Makassar

Sarfaraz Rental Mobil Makassar

A car rental company website presenting the fleet, rates and rental terms, with contact details customers can reach easily from any device.

View Project

Keep reading

Related articles.

Leave a comment

Your email address will not be published. Required fields are marked *