How to Auto-Link ACF Fields (and Why Most Tools Can’t)

An ACF WYSIWYG field in the WordPress editor with an internal link added to a phrase in its text

A user on the Link Whisper support forum asked it in one line back in March: “I’m wondering if the auto-linking feature also add links on ACF fields?” Nobody replied.

Video: Add Links Inside Your Custom Fields Too (Pro)
Video: Add Links Inside Your Custom Fields Too (Pro) (1:04)

The honest answer for most link plugins is no. And it isn’t only auto-links. If a big chunk of your page lives in Advanced Custom Fields, most SEO and link tools can’t see that text at all. Link counts are off, orphan reports lie, and a dead link in a WYSIWYG field can sit there for years.

Here’s why it happens, what you can do about it yourself, and where the DIY route stops.

Almost every link tool reads one thing: the post’s main content, the post_content column you edit in the block editor or the classic editor. Auto-linkers hook into the the_content filter, which runs when WordPress prints that main content.

ACF values don’t live there. They’re stored in post meta (one row per field, in the wp_postmeta table), and your theme prints them with the_field() or get_field() somewhere in a template. The the_content filter never runs on them. So a tool that only listens to the_content never gets a chance to touch the text.

The developer of Interlinks Manager said as much on CodeCanyon: “The_content filter is not applied on the ACF fields, and applying the auto internal links there requires customization.” Rank Math’s own docs say its link counter “analyzes the content that is added inside the post editor (the_content)”. Yoast users have hit the same wall, with a thread literally titled “Internal Links in ACFs not counted”.

What breaks when your text lives in ACF

  • Link counts. A post might link to five others from a “Details” WYSIWYG field, and your SEO plugin shows zero outbound links.
  • Orphan reports. A page that’s only linked from ACF fields looks like nothing links to it. You might “fix” an orphan that isn’t one, or miss one that is. (More on that in our post on finding orphaned pages.)
  • Broken-link checks. If the checker only scans post content, a 404 inside a field stays invisible.
  • Auto-links. Keyword rules never fire inside the field, so the text people actually read on a directory listing or a product spec page gets no links.
  • Bulk URL changes. Change a slug and search-replace post content, and the old URL lives on in the fields.

Sites built on ACF tend to be the ones where this matters most: directories, real estate listings, course catalogues, agency builds where the client edits a set of fields and never touches the main editor.

The boring fix works. ACF’s WYSIWYG field has the same link button as the classic editor. Open the post, select the phrase, add the link. Text and Text Area fields don’t have a toolbar, but you can type an <a href="..."> tag into them if your template prints the value as HTML (check that first, some templates escape it and you’ll see the raw tag on the page).

It’s fine for ten posts. For three hundred listings it isn’t, and it still doesn’t make your SEO plugin count those links. They’ll work for visitors and for search engines crawling the page, but the reports in your dashboard won’t know.

ACF has a filter that runs on a field’s value after get_field() loads it: acf/format_value. It has variations, and the one we want is acf/format_value/type=wysiwyg, which only fires for WYSIWYG fields. Its arguments are $value, $post_id and $field.

Here’s a short snippet that links the first match of each phrase in your list. Put it in a small custom plugin or a code snippets plugin, not in a parent theme you update.

add_filter( 'acf/format_value/type=wysiwyg', function ( $value, $post_id, $field ) {
    if ( is_admin() || ! is_string( $value ) || $value === '' ) {
        return $value;
    }
    $links = [
        'beach houses'   => '/rentals/beach-houses/',
        'pet friendly'   => '/rentals/pet-friendly/',
    ];
    foreach ( $links as $phrase => $url ) {
        if ( stripos( $value, 'href="' . $url ) !== false ) {
            continue; // already linked in this field
        }
        $pattern = '/(?<![\w-])(' . preg_quote( $phrase, '/' ) . ')(?![\w-])(?![^<]*>)(?![^<]*<\/a>)/i';
        $value   = preg_replace( $pattern, '<a href="' . esc_url( $url ) . '">$1</a>', $value, 1 );
    }
    return $value;
}, 20, 3 );

A few notes, because the snippet is small on purpose:

  • We hook at priority 20 so it runs after ACF has formatted the WYSIWYG value (paragraphs added, shortcodes run).
  • The two lookaheads skip text inside an HTML tag and text that’s already inside a link. It’s a regex on HTML, so it’s rough. It will happily link a phrase inside a heading or a table cell. If that bothers you, add the checks.
  • It only fires when your template uses formatted values. get_field( 'name', $id, false ) (third argument false) returns the raw value and skips the filter.
  • It doesn’t skip the current page, so a listing could link to itself. Compare get_permalink( $post_id ) with the URL if that matters.
  • You can narrow it to one field with acf/format_value/name=your_field_name instead.

The big limit: this only changes what’s printed on the page. Nothing is saved to the database. Your SEO plugin’s link counter still won’t see these links, a broken-link checker that reads the database won’t check them, and if you turn the snippet off, every link is gone. It also does nothing for Text or Text Area fields unless you copy it to those types and are sure your template prints them as HTML.

If you want the idea behind keyword rules (one link per phrase, no linking the page to itself, a cap per post), we wrote that up in our guide to automatic internal links in WordPress.

For the counts and broken links, a crawler gets around the problem because it reads the finished page, not the database. A desktop crawler or an online site audit sees every link your theme prints, ACF or not. The catch is that you’re looking at a report outside WordPress, and fixing a link still means finding which field on which post holds it.

For bulk URL changes, a database search-replace tool (WP-CLI’s wp search-replace, or a plugin that does the same) will reach post meta too. Take a backup first. ACF Repeater and Flexible Content fields store values under generated meta keys, and a careless replace can hit things you didn’t mean to.

Where JnK Linkweave fits

Link repairs, the URL changer and undo also change links stored in those ticked fields, not just in the main content.

Auto-links are optional and narrower: if you switch it on, your auto-link rules also link inside the ticked WYSIWYG fields on your site. Only WYSIWYG fields, not plain Text or Text Area fields. If your important text is in a Text Area, Linkweave will count and check its links, but it won’t auto-link it.

You can grab the free download here and see if the rest of it suits your site before deciding on Pro.

Which route to take

Situation What we’d do
A handful of posts with ACF text Add links by hand in the WYSIWYG field
Many posts, you only need links on the page The acf/format_value snippet, tested on staging
You need accurate counts or broken-link checks Run a crawler on the live pages, or a tool that reads the fields
Changing a URL that also appears in fields Backup, then a database search-replace that covers post meta

Whatever you pick, do one quick sanity check: view the page source of a post, find a link that’s inside an ACF field, and see whether your link report knows about it. If it doesn’t, you now know which numbers on your dashboard to trust less. Our internal link checker post has a few more ways to test that.

Frequently asked questions

Not by default. Rank Math’s docs say its link counter analyzes the content added inside the post editor (the_content), and Yoast users have reported links in ACF fields not being counted. The links still work for visitors and crawlers, they just don’t show up in those plugins’ counts.

No. The acf/format_value filter changes the value when it’s loaded for display, so the links only exist on the rendered page. Turn the code off and they disappear, and tools that read the database won’t see them.

No. In Pro, ticked Text, Text Area and WYSIWYG fields count for suggestions, link counts and the broken-link check, but the optional auto-link rules only link inside ticked WYSIWYG fields.