WordPress无真人在线投注网插件极速赛车官网外部链接自动添加nofollow标签
//文章自动nofollowadd_filter( 'the_content', 'tin_seo_wl');function tin_seo_wl( $content ) { $regexp = "<a\s[^>]*href=(\"??)([^\" >]*?)\\1[^>]*>"; if(preg_match_all("/$regexp/siU", $content, $matches, PREG_SET_ORDER)) { if( !empty($matches) ) { $srcUrl = get_option('siteurl'); for ($i=0; $i < count($matches); $i++) { $tag = $matches[$i][0]; $tag2 = $matches[$i][0]; $url = $matches[$i][0]; $noFollow = ''; $pattern = '/target\s*=\s*"\s*_blank\s*"/'; preg_match($pattern, $tag2, $match, PREG_OFFSET_CAPTURE); if( count($match) < 1 ) $noFollow .= ' target="_blank" '; $pattern = '/rel\s*=\s*"\s*[n|d]ofollow\s*"/'; preg_match($pattern, $tag2, $match, PREG_OFFSET_CAPTURE); if( count($match) < 1 ) $noFollow .= ' rel="nofollow" '; $pos = strpos($url,$srcUrl); if ($pos === false) { $tag = rtrim ($tag,'>'); $tag .= $noFollow.'>'; $content = str_replace($tag2,$tag,$content); } } } } $content = str_replace(']]>', ']]>', $content); return $content;}
添加到当前主题Funcions.php 文件中,严格要求的话是需要在外部链接全部加上nofollow标签。如果手动每个链接加入是很麻烦,这样所有的外部链接就会自动加上no极速赛车官网follow标签。真人在线投注网当然我们也可以通过代码实现无插件添加方法。有些外部链接是没有加Nofollow标签,可以直接找一些wordpress插件安装。当然目前一些w<极速赛车官网strong>真人在线投注网ordpress主题设置有这个nofollow标签功能。
在wordpress写文章时,有时内容会引用或分享一些外部链接地址,在技术层面是有传递出去权重。
- 最近发表
- 随机阅读
-
- Javascript植物大战僵尸小游戏LonelyStar版
- CSS3渐变效果linear
- wordpress瀑布流图片主题PhotoBroad模板2.0
- wordpress网站文章链接自动提交给百度
- html5响应式时间轴页面模板大全
- CSS3变形效果transform
- wordpress插件Bing URL Submissions网址自动提交到必应
- 申请/注册新域名需要注意哪些细节
- 高温+越障,追觅S50Pro水箱版仅需2673元,智能洗地新标杆
- 仿新浪微博个人主页html网站模板
- 帝国cms如何实现文章内容代码高亮
- dedecms织梦仿站工具软件下载
- JavaScript对象和数组(Object类型与Array类型)
- wordpress网站文章链接自动提交给百度
- JavaScript什么是正则表达式var
- 织梦dedecms tag伪静态提示信息,系统无此tag
- wordpress XIU主题(阿里百秀)小清新cms模板V5.6
- wppay免登录付费查看隐藏内容/付费资源下载
- WordPress时光轴图片主题Scopic2.0
- 微软Microsoft Edge Image Editor扩展如何关闭?
- 搜索
-
- 友情链接
-