Skip to content

How to Hide Telephone Numbers from Spam Bots in WordPress?

Key Takeaways

  • Nexter Extension Pro añade el shortcode [nxt_encode] en las opciones de Advanced Security de la sección Security para ocultar números de teléfono a bots de spam.
  • [nxt_encode] convierte enlaces como tel:+1555123 en una dirección escrita con códigos de caracteres HTML, mientras los visitantes siguen viendo y pulsando el número con normalidad.
  • El shortcode acepta los atributos link y class, y solo permite esquemas http, https, tel, mailto y sms; si usa otro esquema, como javascript:, no muestra nada.
  • La protección solo codifica la dirección del enlace, no el texto entre etiquetas, así que un número escrito allí sigue siendo legible en el código fuente.
Table of Contents

What It Does

Hide Telephone Numbers from Spam Bots adds an [nxt_encode] shortcode. It turns a clickable link such as tel:+1555123 into a link whose address is written as HTML character codes in the page source. Visitors see and click the number as usual. A simple scraper that looks for tel: in the page source does not find it.

It is a Nexter Extension Pro feature, found in the Advanced Security options of the Security section.

Why It Matters

Phone numbers written as plain tel: links are easy for bots to collect. The result is unwanted calls and messages. You still want real visitors to tap and call, so removing the link is not an option.

What You Get

  • The [nxt_encode] shortcode with two attributes: link and class
  • A clickable link that works for visitors
  • An optional CSS class on the link for your own styling

Benefits

  • Fewer phone numbers collected by simple scrapers
  • No separate plugin. You add one shortcode where the number should appear
  • Works for other link types too, so you can protect an email or SMS link the same way

Capabilities

PartWhat It Does
linkRequired. The address to open, for example tel:+1555123. Start it with tel:, mailto:, sms:, http: or https:. A link with any other scheme, such as javascript:, is dropped and nothing is shown.
classOptional. Adds your own CSS class to the link.
Text between the tagsRequired. This is what visitors see and click, for example the formatted phone number. If it is empty, nothing is shown.

How It Works

  • When the option is on, Nexter registers the [nxt_encode] shortcode.
  • The shortcode cleans the link and allows only these schemes: http, https, tel, mailto and sms. If the link has another scheme, it returns nothing.
  • Each character of the link is written as an HTML character code in the href. Browsers decode it, so the link works.
  • The link is output with rel="nofollow". The text you put between the tags is shown as normal text.

How to Use It

Turn the option on first.

  1. From the WordPress Dashboard, go to Nexter > Nexter Extension > Security.
  2. In the Advanced Security section, turn the toggle on, then click the gear icon.
  3. In the Advanced Security popup, turn on Hide Telephone Secure Spam Bots and click Save.
Nexter Security screen with the Security item selected in the sidebar and the Advanced Security card turned on
Advanced Security popup with the Hide Telephone Secure Spam Bots toggle

Then add the shortcode on any page or post:

[nxt_encode link="tel:+1555123"]+1 (555) 123-4567[/nxt_encode]

Visitors see +1 (555) 123-4567 and can click it. In the page source, the link address is written as character codes.

Page source showing the telephone link address written as HTML character codes

Use Cases

  • A contact page with a click-to-call number
  • A footer or header number on a business site
  • An SMS link, using sms: as the link start
  • An email link, using mailto: as the link start

Limitations

  • It needs Nexter Extension Pro. Without it the shortcode is not available.
  • Only the link address is encoded. The text between the tags is plain text, so a number written there can still be read from the page source. Use wording such as Call us if you want the number hidden there too.
  • Encoding makes harvesting harder. It does not stop a bot that decodes HTML character codes.
  • The shortcode works only where WordPress runs shortcodes, such as post content. It does not change numbers typed elsewhere on your site.
  • Links that use another scheme, such as javascript:, are dropped and nothing is shown.

Troubleshooting

  • The shortcode shows as plain text on the page. The option is off. Turn on the Advanced Security toggle and Hide Telephone Secure Spam Bots, then save. The shortcode is only registered while both are on.
  • Nothing appears. The link or the text between the tags is empty, or the link uses a scheme that is not allowed. Use tel:, mailto:, sms:, http: or https:.
  • The shortcode shows as plain text on a site with only the free plugin. This feature is part of Nexter Extension Pro. Install and activate Pro as well as the free plugin.
  • The number is still visible in the page source. That is the text between the tags, which is not encoded. Only the link address is.

Suggested Reading

Share your Thoughts

Still in Doubt? Let’s Assist You

Have Feedback or Questions?

Join our WordPress Community on Facebook!