WordPress无网上正规靠谱的ag平台pc28下载插件外部链接自动添加nofollow标签
严格要求的话是需要在外部链接全部加上nofollow标签。这样所有的外部链接就会自动加上nofollow标签。有时内容会引用或分享一些外部链接地址, 在wordpress写文章时,*****pc28下载*网上正规靠谱的ag平台有些外部链接是没有加Nofollow标签, 添加到当前主题Funcions.php 文件中,当然我们也可以通过代码实现无插件添加方法。当然目前一些wordpress主pc28下载题设网上正规靠谱的ag平台置有这个nofollow标签功能。如果手动每个链接加入是很麻烦,可以直接找一些wordpress插件安装。在技术层面是有传递出去权重。//文章自动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;}
- 最近发表
- 随机阅读
-
- 爱奇艺qsv/腾讯视频qlv/优酷视频kux格式转换MP4
- WordPress无插件外部链接自动添加nofollow标签
- 个人网站/公司logo标志免费在线制作
- wordpress禁止加载图片属性srcset和sizes
- SEO域名外链生成工具PHP源码
- wordpress响应式瀑布流博客主题snow
- 搜索引擎的工作原理(四)
- Crypto Markets in Retreat: BTC Losses $70K, WIF Plummets 11% Daily (Market Watch)
- BTC Maintains $70K Despite Heightened GBTC Outflows, WIF Plummets Again (Market Watch)
- wordpress简约清新范博客主题Pinghsu
- web前端HTML超级链接属性
- wordpress搬家后上传图片出现错误
- WordPress上传文件尺寸超过php.ini限制解决方法
- CSS背景background样式属性设置
- JavaScript对象和数组(Object类型与Array类型)
- 个人域名IPC备案/网站备案注意事项
- 小米米家推出折叠偏光近视太阳镜,轻巧便携又护眼,仅售199元!
- 优酷/爱奇艺/腾讯vip视频在线解析
- 织梦dedecms红黑配图片模板源码v2.0
- Instagram APP是什么软件
- 搜索
-
- 友情链接
-