-
Notifications
You must be signed in to change notification settings - Fork 195
Open
Description
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:
- Add rel="nofollow" (CSS ID:
#wp-link-nofollow) - 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:
- Install and enable Rank Math SEO plugin
- Add ACF link field to anywhere. For illustration purposes, the link field is called
my_link. I also attached the JSON sync file. - Navigate to any page and use the link field.
- 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"
- Click "Add Link" to save
- Save page
- Thru PHP, dump
my_linklikevar_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
Code
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
Labels
No labels