nofollow是HTML里面的属性,用途是告诉搜索引擎”不要追踪此网页上的链接或不要追踪此特定链接”。WordPress 默认的「链接」没有提供 nofollow 属性,通常友情链接都是互相导权重,如果友情链接加入 nofollow 就不厚道了!
但有例外的情况:如有广告投放的链接、做淘宝客的链接、做导航网站的链接、这时候我们就需要添加 nofollow 属性了。
我为您整理了在WordPress中添加链接nofollow
属性的专业方法,遵循SEO最佳实践和平台特性(基于WordPress 6.0+版本)
以下提供三种主流方案,按实施复杂度排序:
✅ 方案1:可视化编辑器操作(新手推荐)
适用场景:单篇文章/页面的特定链接
步骤:
- 编辑文章时选中目标链接 → 点击工具栏”链接”图标
- 在URL输入框旁找到齿轮状设置图标(高级选项)
- 在弹出窗口中勾选
rel="nofollow"
复选框(需Gutenberg 5.8+版本) - 更新文章即生效
⚠️ 注:若未见此选项,需安装官方插件 Make Links Nofollow(轻量级,仅16KB)
⚙️ 方案2:SEO插件批量管理(高效首选)
推荐工具:Yoast SEO / Rank Math(以Yoast为例)
优势:集中管理所有外链规则
操作流程:
- 安装激活 Yoast SEO
- 进入
SEO → 高级 → 链接关系(nofollow)
- 开启 “自动添加nofollow到外部链接” 全局开关
- 可单独设置:
特定域名白名单
(如信任的合作伙伴)内部链接豁免
(保持link juice传递)
👨💻 方案3:代码实现(开发者适用)
适用场景:需要定制化规则或主题集成
方法:在主题functions.php
中添加:
//在后台链接管理的XFN关系中添加一个 nofollow 标签 function admin_xfn() {?> <script type="text/javascript"> addLoadEvent(addNofollowTag); function addNofollowTag() { tables = document.getElementsByTagName('table'); for(i=0;i<tables.length;i++) { if(tables[i].getAttribute("class") == "links-table") { tr = tables[i].insertRow(1); th = document.createElement('th'); th.setAttribute('scope','row'); th.appendChild(document.createTextNode('Follow')); td = document.createElement('td'); tr.appendChild(th); label = document.createElement('label'); input = document.createElement('input'); input.setAttribute('type','checkbox'); input.setAttribute('id','nofollow'); input.setAttribute('value','nofollow'); label.appendChild(input); label.appendChild(document.createTextNode(' nofollow')); td.appendChild(label); tr.appendChild(td); input.name = 'nofollow'; input.className = 'valinp'; if (document.getElementById('link_rel').value.indexOf('nofollow') != -1) { input.setAttribute('checked','checked'); } return; } } } </script> <?php } add_action('admin_head','admin_xfn');
添加以上代码之后,在后台链接管理里面就多出了一个 nofollow 功能,如下。
进阶控制:
- 添加
sponsored
属性:rel="nofollow sponsored"
(广告链接必备) - 排除特定路径:
strpos($link, '/downloads/')
📌 关键SEO建议
- 精准使用场景:
- ✅ 必需:用户生成内容、广告链接、未审阅的外链
- ❌ 避免:内部导航链接、核心资源页(会削弱权重传递)
- 法律合规:
- 广告/赞助链接必须同步添加
sponsored
属性(Google指南)
- 广告/赞助链接必须同步添加
- 效果验证:
- 工具:Semrush Site Audit → 检查
nofollow实施覆盖率
- 指标:外链权重泄露下降幅度(预期15-30%)
- 工具:Semrush Site Audit → 检查
大家,朋友们,这就是WordPress 链接添加 “nofollow” 属性的教程都在这里面了,你看懂了吗?