Skip to content

Link field does not save nofollow and sponsored fields added by Rank Math SEO #969

@jongc

Description

@jongc

Describe the bug
I'm using Rank Math SEO and it's adding 2 checkboxes to the popup that shows link settings, which goes with the link field type. The checkboxes in question are:

  1. Add rel="nofollow" (CSS ID: #wp-link-nofollow)
  2. Add rel="sponsored" (CSS ID: #wp-link-sponsored)

I found an old thread that ACF is not compatible with Rank Math SEO to do this. However, looking into the code, and I see that target property is managed via JS in assets/build/js/acf-input.min.js.

To Reproduce
Steps to reproduce the behavior:

  1. Install and enable Rank Math SEO plugin
  2. Add ACF link field to anywhere. For illustration purposes, the link field is called my_link. I also attached the JSON sync file.
  3. Navigate to any page and use the link field.
  4. In "Insert/edit link" popup, select or enter URL and Link Text and check all options: (1) Open link in a new tab, (2) Add rel="nofollow", and (3) Add re="sponsored"
  5. Click "Add Link" to save
  6. Save page
  7. Thru PHP, dump my_link like var_dump( get_field('my_link') ), which will output something like:
array (size=3)
  'title' => string 'Test' (length=4)
  'url' => string 'https://localhost/test' (length=22)
  'target' => string '_blank' (length=6)

PHP dump does not show values for the 2 attributes.

Expected behavior

PHP should return values saved for 2 attributes. If I do a dump, I should see something like:

array (size=5)
  'title' => string 'Test' (length=4)
  'url' => string 'https://localhost/test' (length=22)
  'target' => string '_blank' (length=6)
  'nofollow' => boolean true
  'sponsored' => boolean true

Screenshots or Video

Image

Code

group_6887e2457ce6b.json

Version Information:

  • WordPress Version: 6.8.1
  • PHP Version: 8.2
  • ACF Version: ACF Pro 6.4.2
  • Browser: Chrome

Additional context
None

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions