Link field does not save `nofollow` and `sponsored` fields added by Rank Math SEO
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 45/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- javascript, php
- 领域
- full-stack
调研方向
启用 Rank Math SEO 并使用 ACF 链接字段重现该问题,然后检查 assets/build/js/acf-input.min.js 以及报告中所述的链接字段处理。只有当 nofollow 和 sponsored 复选框的值与 title、url 和 target 一起在 get_field('my_link') 中保存并返回时,修复才算完成。
由索引模型根据 Issue 内容生成。
描述
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
- 主要语言
- PHP
- 星标
- 948
- 派生
- 198
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
AdvancedCustomFields/acf 的其他 Issue
-
PHP 8.5: "Using null as an array offset" deprecation in ACF_Data::is() when rendering a block with empty data (local-meta.php is_request)可能已有人在做 @faisalahammad 于 8 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 68/100
AdvancedCustomFields/acf#1044 ·
-
is_preview was called incorrectly notice on every early get_field() since 6.8.10 (acf_revisions::acf_validate_post_id)可能已有人在做 @faisalahammad 于 8 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
AdvancedCustomFields/acf#1041 · 1 条评论 ·
-
True / False ACF control bug on RTL layouts可能已有人在做 @elicohenator 于 31 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 86/100
AdvancedCustomFields/acf#1038 ·
-
难度 2/5 1-3 小时 新手友好度 78/100
AdvancedCustomFields/acf#1034 · 3 条评论 ·
-
Bug: class-acf-field-icon_picker.php calls wp_get_attachment_image_url() with string Dashicon slug, causing fatal TypeError on PHP 8+可能已有人在做 @antwonw 于 42 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 86/100
AdvancedCustomFields/acf#1032 · 1 条评论 ·
查看 AdvancedCustomFields/acf 的全部 Issue
相似的 Issue
-
sync-en
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复
-
[Sync EN] Document Error thrown by shm_* functions on a detached segment (#5975)可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭sync-en
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 3 天内回复
-
Перевод устарел
难度 2/5 1-3 小时 新手友好度 72/100
-
难度 2/5 1-3 小时 新手友好度 72/100
-
新版升级一下对应的依赖可以么未关闭
难度 2/5 1-3 小时 新手友好度 62/100