欢迎您光临自学哈网,只为分享网络知识教程,供大家学习参考!

「自学哈网」WordPress 给关键字自动添加文章链接

作者 : 自学哈 本文共689个字,预计阅读时间需要2分钟 2022-11-26 共129人阅读
也想出现在这里? 联系我们

WordPress 发表文章后,建立锚文本链接在网站优化中有很重要的作用,

WoredPress 可通过添加函数设置特定关键字自动添加链接。

方法1:添加代码实现

在你的主题下面的 functions.php 文件里,添加以下代码

function replace_content_keyword($content){
  $replace = array(
      \'小兽wordpress\' => \'<a href=\"https://www.seo628.com\" rel=\"home\">小兽wordpress</a>\',
      \'wordpress主题\' => \'<a href=\"https://www.seo628.com\" rel=\"home\">wordpress主题</a>\',
      \'wordpress企业主题\' => \'<a href=\"https://www.seo628.com\" rel=\"home\">wordpress企业主题</a>\',
   );
  $content = str_replace(array_keys($replace), $replace, $content);
  return $content;
}
add_filter(\'the_content\', \'replace_text_wps\');

方法2:安装插件实现

WP Keyword Link (已下架)

Links Auto Replacer 官网:https://wordpress.org/plugins/links-auto-replacer/

Links Auto Replacer zip包:links-auto-replacer.zip

本站声明:
本站所有资源来源于网络,分享目的仅供大家学习和交流!如若本站内容侵犯了原著者的合法权益,可联系邮箱976157886@qq.com进行删除。
自学哈专注于免费提供最新的分享知识、网络教程、网络技术的资源分享平台,好资源不私藏,大家一起分享!

自学哈网 » 「自学哈网」WordPress 给关键字自动添加文章链接
也想出现在这里? 联系我们
© 2022 Theme by - 自学哈网 & WordPress Theme. All rights reserved 浙ICP备2022016594号