WordPress link handling

Open external links in a new tab, without losing the reader

External Links finds every link in your content pointing to another domain, opens it in a new tab, and adds the right rel attributes automatically, leaving internal links completely untouched.

  • Every external link opens in a new tab automatically.
  • noopener, noreferrer and nofollow, each switchable on its own.
  • Exclude specific domains or URLs from the whole process.
  • Internal links are never touched.
Outbound Link HandlingExternal Links

Select which post types the filter should apply to. Leave all unchecked to apply to every post type.

PostsPagesMy TemplatesListing Items/Components

Rel attributes to add

noopenerPrevents the new tab from accessing the opener window.
noreferrerHides the referrer header from the destination site.
nofollowTells search engines not to pass SEO authority.

Exclude Domains / URLs

example.com
https://partner.com/specific-page
External links open in a new tab3 rel attributes applied automatically.
Active
Quick answer

What does External Links do?

When the external_links module is active, TOWP_External_Links filters the_content and widget_text_content, and, if enabled, render_block and widget_block_content for Gutenberg and Full Site Editing content, to scan every <a> tag with an href. For each one, it checks whether the link points to the site's own domain, an excluded domain or URL, or a non-http(s) protocol like mailto: or tel:, and leaves those completely alone. Every other link gets target="_blank" and a merged rel attribute built from whichever of noopener, noreferrer and nofollow are enabled, combined with any rel value the link already had rather than overwriting it.

The "reader leaves and doesn't come back" problem

An external link can be the last thing a reader clicks

Because outbound links replace the page by default, a single reference can quietly end a visit that would otherwise have continued.

A link to another site can end the visit entirely

Without opening in a new tab, an external reference replaces the page a reader was on, and not every reader thinks to hit the back button afterward.

The right rel attributes rarely get added by hand

Security-relevant attributes like noopener, and SEO-relevant ones like nofollow, matter on every outbound link, but writing them into every <a> tag by hand across an entire site isn't realistic.

A dedicated WordPress solution

Every outbound link, handled consistently

The module finds every external link automatically and applies the right target and rel attributes, without touching a single internal link.

Opens in a new tab, automatically

Every link to another domain gets target="_blank", so a reader following a reference never loses the page they were reading.

The right rel attributes, applied for you

noopener and noreferrer close off real security and privacy considerations that come with opening links in a new tab.

Internal links, completely untouched

Since the module compares a link's own domain against the site's, nothing about internal navigation ever changes.

Verified feature set

Precise detection, nothing left ambiguous

Every capability below is present in the supplied PHP class and its settings registration.

Internal link protection

Compared against the site's own host

The module normalizes the link's hostname and compares it to the site's own, so a link back to the same domain always stays untouched.

Host normalizationwww. handled automatically
Three independent rel attributes

noopener, noreferrer, nofollow

Each attribute is switchable on its own, and defaults to enabled the first time the module runs, so a fresh install ships secure by default.

Independently toggleableSecure by default
Rel values merged, not overwritten

Respects any rel already on the link

If a link already carries its own rel attribute, the module's values get merged into it rather than replacing what was already there.

array_unique mergeNo data loss
Domain and URL exclusions

Skip specific destinations entirely

An excluded entry can be a bare domain or a full URL prefix, letting a specific page on a partner site stay excluded without excluding the whole domain.

Domain matchURL prefix match
Gutenberg and FSE support

An explicit opt-in

Block-rendered content, including Full Site Editing templates and block widgets, only receives processing once this is turned on separately.

render_blockwidget_block_content
Practical use cases

Where consistent link handling helps most

The module supports any site that references other domains regularly within its content.

Content-heavy sites with frequent external references

Keep readers on an article or guide even as it links out to sources, without manually managing target and rel attributes on every link.

Sites with an affiliate or partner domain to exclude

Keep a specific partner domain opening in the same tab, or without nofollow, while every other external link gets the default treatment.

SEO and security-conscious publishing

Apply nofollow consistently across every outbound link without relying on an editor remembering to add it by hand each time.

Operational benefits

Readers retained, attributes handled correctly

The module combines a real retention benefit with genuine security and SEO considerations, applied consistently.

Readers stay on the pageAn external reference opens alongside the original content instead of replacing it.
A closed security gap, by defaultnoopener specifically prevents a known browser security issue where a new tab can manipulate the page that opened it.
Referrer information withheld automaticallynoreferrer stops the destination site from seeing where the traffic came from, when that's the desired behaviour.
Fine control without manual editingPost type targeting, individual rel toggles and a domain exclusion list together cover cases a blanket rule can't.
Performance behaviour

One regex pass, skipped when there's nothing to do

The verified implementation avoids unnecessary work on content with no links to process.

A single regex pass per content block

The entire process runs as one pattern match and callback per piece of content, not a separate operation per link.

Skips content with no links at all

An early check for the presence of an <a tag avoids running the full regex on content that has no links to process.

No processing for internal-only content

A post or page with only internal links still receives a full scan, but every link resolves quickly to "leave unchanged" without any external request.

Security implementation

Real protections, applied automatically

The rel attributes this module adds address specific, documented browser and privacy considerations.

01

noopener closes a real browser security gap

Without it, a page opened in a new tab can, in some cases, redirect the original tab it came from; noopener blocks that specifically.

02

noreferrer controls what the destination site learns

Withholding the referrer header is a genuine privacy consideration for both the site and its readers.

03

Administrator-only configuration

Only an administrator with access to TheOneWP settings can change how the site handles external links.

04

No effect on link destinations

The module only adds attributes to existing links; it never rewrites, redirects, or changes where a link actually points.

Verified compatibility

Built around every native WordPress content filter

The supplied code integrates through APIs present in WordPress core; this page makes no compatibility claim beyond the verified implementation.

Content filters

the_content and widget_text_content

The standard WordPress filters for post content and classic text widgets, both processed by default.

the_contentwidget_text_content
Block content filters

render_block and widget_block_content

The filters that cover Gutenberg block output and Full Site Editing content, applied only when explicitly enabled.

render_blockwidget_block_content
URL parsing

wp_parse_url()

WordPress's own URL parsing function, used to extract and compare hostnames consistently.

wp_parse_urlHost normalization
Solution comparison

TheOneWP versus common alternatives

Compare the verified External Links implementation with editing link attributes by hand.

CapabilityTheOneWP External LinksOther common solutions
Detecting external vs internal links Compared against the site's own host automaticallyOften requires manually tagging or categorizing links
Rel attribute control Three independent toggles, merged with existing valuesFrequently an all-or-nothing rel string, or overwrites what was there
Domain and URL exclusions Both plain domains and full URL prefixes supportedRarely offered with this level of precision
Gutenberg and FSE coverage An explicit, separate opt-inOften missed entirely by classic-editor-only solutions
Administration One settings screen, nothing to edit per linkRequires manually editing every link's attributes
Recommended workflow

Configure outbound links in four steps

Since the defaults already ship secure, most sites only need to adjust the exclusion list.

01

Enable External Links

Activate the module from the TheOneWP Content settings tab.

02

Choose which rel attributes to include

Leave noopener, noreferrer and nofollow on by default, or switch off any that don't fit the site's needs.

03

Add any domains or URLs to exclude

List specific partner domains or pages that should stay untouched, one per line.

04

Decide on Gutenberg block content

Turn on block processing if the site relies on Full Site Editing or block-based widgets for its content.

Best practices

The defaults work; tune the exceptions

Most of the value here comes from the defaults; the exclusion list is where genuine judgment applies.

01

Keep noopener enabled

It closes a genuine security consideration and has essentially no downside for any site.

02

Reconsider nofollow for genuinely trusted partners

A domain listed in the exclusion list can keep passing SEO authority when that's actually the intent.

03

List exact URLs, not just domains, when only one page matters

The exclusion list supports full URL prefixes specifically so a single page can stay excluded without excluding an entire domain.

04

Enable Gutenberg processing if the site uses block widgets or FSE

Without it, links inside block-rendered content won't get the same treatment as links in regular post content.

Common mistakes

Avoid assumptions that leave links unhandled

A couple of settings behave differently from what a first glance might suggest.

Forgetting to enable Gutenberg block processing

A site built with Full Site Editing or block widgets needs this turned on separately, or those links stay untouched entirely.

Assuming the post type filter defaults to nothing

Leaving every post type unchecked doesn't disable the module; it applies the filter to every post type by default.

Excluding a domain when only one page needed excluding

A domain-level exclusion skips every link to that domain; a full URL prefix is the more precise choice for a single page.

Frequently asked questions

External Links FAQ

These answers come directly from the verified class and its settings registration.

What does External Links do?

It finds every link in content pointing to another domain, opens it in a new tab, and adds configurable rel attributes, while leaving internal links completely unchanged.

Does this affect internal links on my own site?

No. The module compares a link's host against the site's own domain, and internal links always stay exactly as written.

What do noopener, noreferrer and nofollow actually do?

noopener stops a new tab from accessing the page that opened it, noreferrer withholds the referrer header from the destination, and nofollow tells search engines not to pass authority to the linked domain.

Can I exclude a specific partner domain from this behavior?

Yes. The exclusion list accepts both plain domains and full URL prefixes, one per line.

Does this work with the block editor?

Only if "Apply to Gutenberg blocks" is turned on; by default, the module only processes regular post content and classic text widgets.

Will this overwrite a rel attribute I already added manually?

No. The module merges any existing rel value on a link with its own values rather than replacing them.

Does this apply to every post type by default?

Yes. Leaving every post type unchecked applies the filter to every post type; checking specific types limits it to just those.

Does this affect links to mailto: or tel: addresses?

No. The module only processes http and https links, leaving other protocols untouched.

What happens to a link's target attribute if it already has one?

The module replaces it with target="_blank" for any external link that qualifies.

Who can configure how external links are handled?

Only an administrator with access to the TheOneWP settings screen.

Stop losing readers to outbound links.Handle every external link consistently, automatically.

Use External Links to open outbound links in a new tab with the right rel attributes, without touching a single internal link.