WordPress无九游app插件外部链接自动添加nofollow标签线上网投在澳门的合法性
在wordpress写文章时,可以直接找一些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;}
添加到当前主题Funcions.php 文件中,这样所有的外部链接就会自动加上nofollow标签。如果手九游线上网投在澳门的合法性app动每个链接加入是很麻烦,严格要求的话是需要在外部链接全部加上nofollow标签。有时内容会引用或分享一些外部链接地址,有些外部链接是没有加Nofollow标签,
-
上一篇
-
下一篇
- 最近发表
- 随机阅读
-
- jquery实现网站侧边栏社交分享按钮
- WordPress插件Redirection 301重定向跳转
- 圣诞节幽灵404页面代码
- Crypto Markets in Retreat: BTC Losses $70K, WIF Plummets 11% Daily (Market Watch)
- WordPress多功能免费主题Git(乐趣公园)下载
- wordpress(大前端)DUX主题v5.0模板下载
- wordpress小程序导航收录/小程序模板主题
- Crypto Markets in Retreat: BTC Losses $70K, WIF Plummets 11% Daily (Market Watch)
- favicon.ico图片在线制作PHP源码
- 烟雨开源图床系统源码v2.1下载
- 易优eyoucms模板源码安装教程
- 鼠标经过文字显示隐藏图片css样式
- SEO搜索引擎的起源/发展
- WordPress博客网站301重定向的两种方法
- JavaScript语法构成/关键字保留字及变量
- WordPress免插件实现文章代码高亮方法
- wordpress(大前端)DUX主题v5.0模板下载
- wordpress仿微博个人博客主题tongleer
- wordpress网站隐藏内容付费阅读/下载插件foxpay
- mp3音乐app界面js设计模板
- 搜索
-
- 友情链接
-