WordPress无庄闲的80%赢法插件外部链接自动添加nofollow标签13分钟秒dong:极速赛车最好的投注方法
如果手动每个链接加入是很麻烦,严格要求的话是需要在外部链接全部加上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 文件中,当然目前一些w庄闲的80%赢法ordpress主题设置有这个nofollow标签功能。13分钟秒dong:极速赛车最好的投注方法
在wordpress写文章时,可以直接找一些wordpress插件安装。当然我们也可以通过代码实现无插件添加方法。
- 最近发表
- 随机阅读
-
- wordpress仿微博个人博客主题tongleer
- 分类目录缩略图自动截图/生成api有哪些
- 科沃斯T50 Pro扫拖机器人水箱版,3999元降至2235元,百亿补贴优惠不妥协
- wordpress博客纯代码去掉分类目录Category
- wordpress响应式瀑布流博客主题snow
- wordpress博客新闻杂志主题SimultLite
- jQuery弹出层页面社交分享代码
- 网站网页内容文字禁止复制如何解决?
- 圆形滚动404动画页面特效
- Crypto Markets Add $70 Billion Daily as Bitcoin (BTC) Soars Past $71K (Market Watch)
- mp3音乐app界面js设计模板
- 大旗发帖助手下载/使用教程
- wordpress(大前端)DUX主题v5.0模板下载
- 申请/注册新域名需要注意哪些细节
- 浏览器屏蔽广告插件广告终结者
- 新浪微博主页侧边栏跟随页面滚动代码
- html+js简洁的音乐播放器,总有一款适合你
- jquery css3图片翻转3D动画切换特效代码
- jquery图片轮播展示带文字带缩略图代码
- 宝塔面板MySQL数据库自动重启设置
- 搜索
-
- 友情链接
-