WordPress无ag电游游戏网址插件外部链接自动添加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标签。这样所有的外部链接就会自动加上nofollow标签。当然目前一些wordpress主题设置有这个nofollow标签功能。有时内容会 在wordpress写文章时,可以直接找一些wordpress插件安装。***大满贯ag电游游戏网址***在技术层面是有传递出去权重。如果手动每个链接加入是很麻烦,有些外部链接是没有加Nofollow标签,
- 最近发表
- 随机阅读
-
- wordpress博客纯代码去掉分类目录Category
- wordpress评论者链接在新窗口打开
- 优酷/爱奇艺/腾讯vip视频在线解析
- wordpress个人博客修改文章链接ID
- 通过PhpMyAdmin找回wordpress登录密码
- SEO网站优化之URL的写法
- 网站被IP频繁访问(阿里主机887timed out)
- wordpress禁止加载图片属性srcset和sizes
- wordpress瀑布流图片主题PhotoBroad模板2.0
- wordpress网站文章链接自动提交给百度
- javascript数据类型
- WordPress评论头像无法显示 解决gravatar头像被屏蔽
- dedecms仿站之list
- 个人博客网站日志404状态码分析
- web前端JavaScript介绍
- SEO网站编辑文章如何伪原创
- CSS颜色color与度量单位em
- 电脑本地搭建dedecms/帝国cms个人网站教程
- wordpress网站隐藏内容付费阅读/下载插件foxpay
- wordpress博客纯代码去掉分类目录Category
- 搜索
-
- 友情链接
-