WordPress无极速庄闲游戏app赛车官网插件外部链接自动添加nofollow标签
有些外部链接是没有加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 文件中,当然我们也可以通过代码实现无插件添加方法。
如果手动在wordpress写文章时,可以直接找极速庄闲游戏app赛车官网一些wordpress插件安装。严格要求的话是需要在外部链接全部加上nofollow标签。当然目前一些wordpress主题设置有这个nofollow标签功能。在技术层面是有传递出去权重。
- 最近发表
- 随机阅读
-
- javascript位运算符与赋值运算符
- DOGE, WIF Emerge as Today's Top Performers, BTC Aims at $70K (Weekend Watch)
- wordpress禁止加载图片属性srcset和sizes
- wordpress搬家后上传图片出现错误
- wordpress/帝国cms配置https(SSL)无法登录后台
- Instagram APP是什么软件
- 圆形滚动404动画页面特效
- 纤薄机身扫地新宠:科沃斯T50 PRO,水箱版1613元国补新低,体验升级更轻松
- Microsoft office2007免费版下载
- php在线搜索音乐播放器源码
- CSS盒模型内边距padding外边距margin
- CSS3流体多列布局columns属性
- wordpress上传图片禁止自动生成缩略图
- web前端CSS传统布局position属性
- 个人域名IPC备案/网站备案注意事项
- 太空动态404错误页面html代码
- 荣耀手表Fit即将揭秘健康能量评估功能,萌宠表盘引爆5月28日,科技与时尚碰撞,你准备好了吗?
- CSS文本样式text
- WordPress文章历史修订版本与自动草稿保存问题
- 利用excel分析IIS服务器日志
- 搜索
-
- 友情链接
-