Docs

Magic links

4 min readUpdated November 19, 2026

A magic link lets a user sign in without typing a password. They enter their email address or username, Shield emails them a one-time link, and clicking the link signs them in.

How it works#

  1. The login page shows Email me a login link, under the login form.
  2. The user clicks it and lands on a page titled Sign in without a password: “Enter your email address or username and we will send you a one-time login link.”
  3. They enter their Email or username and click Send login link.
  4. Shield shows a neutral message: “If an account exists for that address, a login link has been sent. It expires in N minutes and can only be used once.”
  5. The user opens the email and clicks the sign-in button.
  6. They’re signed in and sent where they were headed, usually the dashboard.

The message in step 4 is the same whether or not an account exists. This stops anyone from using the form to find out which emails or usernames are registered.

A WordPress login form featuring fields for a username or email address and password, with a “Log In” button and a “Sign in with a passkey” option. Additional links below include “Email me a login link,” “Lost your password?”, and a link to return to the Nahnu Login Shield.
  1. Go to Settings → Login Shield and open the Passwordless tab.
  2. Find the Magic link (email login) section.
  3. Turn on Enable magic link: “Show “Email me a login link” on the login page”.
  4. Set the options below.
  5. Click Save passwordless settings.
A settings interface for a login plugin features toggles and checkboxes for “Magic link” and “Passkeys.” The form includes input fields for link lifetime and relying party ID, alongside role selection checkboxes for administrators, editors, authors, contributors, subscribers, and agents.

The options

OptionWhat it does
Enable magic linkShows the “Email me a login link” option on the login page.
Link lifetimeHow long a link stays valid, from 5 to 60 minutes. The default is 15.
Allowed rolesTick the roles that can use magic links. Leave all unticked to allow every role.
WooCommerce“Also show on the WooCommerce My Account login form.” On by default.
  • Each link works once. After it is used, it’s dead.
  • A new request cancels the old link. Only the latest link works.
  • The limit is 3 requests per 15 minutes, per IP address and per account.
  • Links expire after the lifetime you set. An expired or used link shows “That login link is invalid or has expired. Please request a new one.”
  • The link isn’t tied to a device. A user can request it on their computer and click it on their phone. Shield records the IP address difference in the log.
  • Shield stores only a scrambled form of the link’s secret, never the secret itself.

The request form is protected the same way as the normal login form:

  • Lockouts, the IP blocklist and geo-blocking apply. A blocked IP can’t request a link, and the attempt is logged.
  • The CAPTCHA widget and the JavaScript check apply to the request form, if you use them.
  • Honeypot usernames apply. Typing one is treated as an attack.
  • Rate limits apply, as above.
  • 2FA still applies to stronger methods. After a magic link, a user who has added an authenticator app or passkey is still asked for that second step. A user who only has email codes is not asked again, because the link already proved they can read that inbox. See “How 2FA works”.

Magic links are only as secure as the user’s email account. Anyone who can read the inbox can sign in. For high-privilege roles, consider limiting magic links (see “Limit passwordless sign-in by role”).

The email comes from the same branded template as the 2FA code. You can change the subject, heading and message under Email branding on the Settings tab. The sign-in button is always shown, even if you remove the {link} placeholder from the text. The placeholders are {site_name} {user_name} {link} {minutes} {ip}. The default subject is “Your login link for [site name]”.

The email is sent in the background, so it can arrive a few seconds late.

Users can opt out#

On the Login & security page, in Sign-in options, a user can turn off the switch on the Email login link row. Then “Email me a login link” won’t send a link for their account. See “The Login & security page for users”.

The Sign-in options card with three rows: Password (On), Email login link with a switch to turn emailed login links off for this account, and Passkey (Not set up).
  • A request form anywhere: add the shortcode to a page.
  • For developers: the template functions and the REST endpoint are in the Developer API docs.

Troubleshooting#

  • No “Email me a login link” option: magic links are off, or the page is not the login form. On WooCommerce, check the WooCommerce option.
  • The email never arrives: check spam and your site’s email delivery. Test with the Send test button in Email branding. Remember the neutral message appears even if no email was sent.
  • No email after several requests: the limit is 3 requests per 15 minutes, per IP and per account. The page still shows the neutral message. Wait 15 minutes. The Log tab shows “Magic link rate-limited”.
  • “That login link is invalid or has expired.”: the link was used, expired, or replaced by a newer one. Request a new one.
  • “Access temporarily restricted. Please try again later.”: the user’s IP is locked out, blocklisted or geo-blocked.
  • “Passwordless login is not available for this account.”: the user’s role isn’t allowed, or they opted out.
  • The user is asked for a second step after the link: this is expected for users who have added an authenticator app or passkey.

Was this helpful?

This website uses cookies to enhance your browsing experience and ensure the site functions properly. By continuing to use this site, you acknowledge and accept our use of cookies.

Accept All Accept Required Only