WordPress无麻将胡了pc28加拿大平台50一拉满屏发财插件外部链接自动添加nofollow标签
当然我们也可以通过代码实现无插件添加方法。有些外部链接是没有加Nofollow标签, 在wordpress写文章时,当然目前一些wordpress主题设置有这个nofollow标签功能。 添加到当前主题Funcions.php 文件中,有时内容会引用或分享一些外部链接地址,这样所有的外部链接就会自动加上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)) { pc28加拿大平台>麻将胡了50一拉满屏发财 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;}
- 最近发表
- 随机阅读
-
- PHP彩虹工具网源码 支持插件扩展
- html5常用标签定义及使用说明
- dedecms织梦网站模板源码图文安装教程
- DOGE, WIF Emerge as Today's Top Performers, BTC Aims at $70K (Weekend Watch)
- 生态环境部发布《2024中国生态环境状况公报》
- 织梦dedecms文章内容如何批量替换
- 11.6亿元!沂源县沂河沂源源头水保护区环境治理与产业开发EOD项目一期将招标
- Crypto Markets in Retreat: BTC Losses $70K, WIF Plummets 11% Daily (Market Watch)
- 2024黄色闪电404错误页面代码
- 免费简单图床EasyImages2.0源码
- wordpress M1主题(精仿唬嗅网v2.3)/新闻网站模板/cms模板
- 2024黄色闪电404错误页面代码
- wordpress隐藏文章部分内容需要注册登录后可见
- 微博图片显示403无法打开如何解决?
- JavaScript时间与日期(Date类型)
- 纤薄机身扫地新宠:科沃斯T50 PRO,水箱版1613元国补新低,体验升级更轻松
- 李炎恢老师HTML5第一季视频教程下载
- 优酷/爱奇艺/腾讯vip视频在线解析
- 个人博客网站如何实现https重定向(301)到http
- jQuery弹出层页面社交分享代码
- 搜索
-
- 友情链接
-