Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

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

Đang mở
#969 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
45/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
javascript, php
Lĩnh vực
full-stack

Hướng nghiên cứu

Tái hiện vấn đề khi Rank Math SEO được bật và có trường liên kết ACF, sau đó kiểm tra assets/build/js/acf-input.min.js và cách xử lý trường liên kết được mô tả trong báo cáo. Bản sửa hoàn tất khi các giá trị của hộp kiểm nofollow và sponsored được lưu và trả về cùng với title, url và target trong get_field('my_link').

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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

Ngôn ngữ chính
PHP
Star
948
Fork
198
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của AdvancedCustomFields/acf

Tất cả issue của AdvancedCustomFields/acf

Issue tương tự

Thêm issue về PHP

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.