wordpress插件/WordPress SEO插件推荐:Nofollow for external link开心无限制版
最近更新 2023年02月14日
资源编号 13106

#推荐
wordpress插件/WordPress SEO插件推荐:Nofollow for external link开心无限制版

2023-02-14 其他源码 0 3,532
郑重承诺丨奇偶源码提供安全交易、信息保真!
增值服务:
安装指导
环境配置
二次开发
网站建设
网站建设
模板修改
¥ 0 C币
VIP折扣
    折扣详情
  • 免费

  • 免费

  • 免费

  • 免费

开通VIP尊享优惠特权
立即下载 升级会员
详情介绍

[wordpress插件] WordPress SEO插件推荐:Nofollow for external link开心无限制版 版权原因。已下架

给WordPress文章或评论内容的站外链接添加Nofollow属性,在博客里编写文章的时候都会用到一些外链,外链这个东西根据每个人对SEO的理解层面不同所以运用上也都有不同的手法,非常多的站长在使用wordpress发表文章带外链的文章时都会给外链添加nofollow属性。

方法1:直接安装插件即可,不想用插件的可以参考方法2
方法2:打开我们所用的主题的模板函数文件,也就是functions.php 文件,将下面的代码加到模板函数里面,它会给外部链接自动添加

代码如下:

// 在主题模板functions.php文件中添加add_filter('the_content', 'auto_nofollow'); //nofollow文章内容的站外链接add_filter('comment_text', 'auto_nofollow'); //nofollow评论内容的站外链接function auto_nofollow($content) {//return stripslashes(wp_rel_nofollow($content));return preg_replace_callback('/a]+/', 'auto_nofollow_callback', $content);}function auto_nofollow_callback($matches) {$link = $matches[0];$site_link = get_bloginfo('url');if (strpos($link, 'rel') === false) {$link = preg_replace(%(href=S(?!$site_link))%i, 'rel=nofollow $1', $link);} elseif (preg_match(%href=S(?!$site_link)%i, $link)) {$link = preg_replace('/rel=S(?!nofollow)S*/i', 'rel=nofollow', $link);}return $link;}
// 在主题模板functions.php文件中添加add_filter('the_content', 'auto_nofollow'); //nofollow文章内容的站外链接add_filter('comment_text', 'auto_nofollow'); //nofollow评论内容的站外链接function auto_nofollow($content) {//return stripslashes(wp_rel_nofollow($content));return preg_replace_callback('/a]+/', 'auto_nofollow_callback', $content);}function auto_nofollow_callback($matches) {$link = $matches[0];$site_link = get_bloginfo('url');if (strpos($link, 'rel') === false) {$link = preg_replace(%(href=S(?!$site_link))%i, 'rel=nofollow $1', $link);} elseif (preg_match(%href=S(?!$site_link)%i, $link)) {$link = preg_replace('/rel=S(?!nofollow)S*/i', 'rel=nofollow', $link);}return $link;}
// 在主题模板functions.php文件中添加add_filter('the_content', 'auto_nofollow'); //nofollow文章内容的站外链接add_filter('comment_text', 'auto_nofollow'); //nofollow评论内容的站外链接function auto_nofollow($content) {//return stripslashes(wp_rel_nofollow($content));return preg_replace_callback('/a]+/', 'auto_nofollow_callback', $content);}function auto_nofollow_callback($matches) {$link = $matches[0];$site_link = get_bloginfo('url');if (strpos($link, 'rel') === false) {$link = preg_replace(%(href=S(?!$site_link))%i, 'rel=nofollow $1', $link);} elseif (preg_match(%href=S(?!$site_link)%i, $link)) {$link = preg_replace('/rel=S(?!nofollow)S*/i', 'rel=nofollow', $link);}return $link;}
// 在主题模板functions.php文件中添加add_filter('the_content', 'auto_nofollow'); //nofollow文章内容的站外链接add_filter('comment_text', 'auto_nofollow'); //nofollow评论内容的站外链接function auto_nofollow($content) {//return stripslashes(wp_rel_nofollow($content));return preg_replace_callback('/a]+/', 'auto_nofollow_callback', $content);}function auto_nofollow_callback($matches) {$link = $matches[0];$site_link = get_bloginfo('url');if (strpos($link, 'rel') === false) {$link = preg_replace(%(href=S(?!$site_link))%i, 'rel=nofollow $1', $link);} elseif (preg_match(%href=S(?!$site_link)%i, $link)) {$link = preg_replace('/rel=S(?!nofollow)S*/i', 'rel=nofollow', $link);}return $link;}

// 在主题模板functions.php文件中添加

add_filter(‘the_content’, ‘auto_nofollow’); //nofollow文章内容的站外链接

add_filter(‘comment_text’, ‘auto_nofollow’); //nofollow评论内容的站外链接

function auto_nofollow($content) {

//return stripslashes(wp_rel_nofollow($content));

return preg_replace_callback(‘/a]+/’, ‘auto_nofollow_callback’, $content);

}

function auto_nofollow_callback($matches) {

$link = $matches[0];

$site_link = get_bloginfo(‘url’);

if (strpos($link, ‘rel’) === false) {

$link = preg_replace(%(href=S(?!$site_link))%i, ‘rel=nofollow $1’, $link);

} elseif (preg_match(%href=S(?!$site_link)%i, $link)) {

$link = preg_replace(‘/rel=S(?!nofollow)S*/i’, <span class="enlighter-s0" style="margin: 0px; padding: 0px; border: 0px; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; backgr

  • wordpress插件/WordPress SEO插件推荐:Nofollow for external link开心无限制版

1. 本站所有资源来源于用户上传和网络,如有侵权请邮件联系站长!
2. 分享目的仅供大家学习和交流,您必须在下载后24小时内删除!
3. 不得使用于非法商业用途,不得违反国家法律。否则后果自负!
4. 本站提供的源码、模板、插件等等其他资源,都不包含技术服务请大家谅解!
5. 如有链接无法下载、失效或广告,请联系管理员处理!
6. 本站资源售价只是赞助,收取费用仅维持本站的日常运营所需!
7. 如遇到加密压缩包,请使用WINRAR解压,如遇到无法解压的请联系管理员!
8. 精力有限,不少源码未能详细测试(解密),不能分辨部分源码是病毒还是误报,所以没有进行任何修改,大家使用前请进行甄别

奇偶源码 其他源码 wordpress插件/WordPress SEO插件推荐:Nofollow for external link开心无限制版 https://www.7or.cn/13106.html

相关文章

官方客服团队

为您解决烦忧 - 24小时在线 专业服务