By using this site, you agree to the Privacy Policy and Terms of Use.
接受
智诚云集
  • 首页
  • 互联网
  • 分享
  • 记录
  • 互联网
    • Blog Index
    • Search Page
    • 404 Page
  • 联系
阅读: WordPress文章外链添加go跳转
SUBSCRIBE
智诚云集智诚云集
Font ResizerAa
  • 云服务器推荐
  • 腾讯云
  • 阿里云
  • 京东云
Search
  • Home
  • Home
  • Blog
  • Blog
  • Categories
    • Technology
    • Travel
    • Lifestyle
    • Market
    • Innovate
    • Insurance
  • Categories
    • Technology
    • Travel
    • Lifestyle
    • Market
    • Innovate
    • Insurance
  • Bookmarks
  • Bookmarks
  • More Foxiz
    • Blog Index
    • Sitemap
  • More Foxiz
    • Blog Index
    • Sitemap
  • Contact
  • Contact
Have an existing account? 登录
关注我们
© Foxiz News Network. Ruby Design Company. All Rights Reserved.
记录

WordPress文章外链添加go跳转

智诚云集 - Xyok.Cn
最后更新: 2025年12月6日 下午9:35
智诚云集 - Xyok.Cn
8 Min Read
分享
分享

/* WordPress文章外链添加go跳转
*/
function loper_content_nofollow($content){
preg_match_all(‘/<a(.*?)href=”(.*?)”(.*?)>/’,$content,$matches);
if($matches){
foreach($matches[2] as $val){
if(strpos($val,’://’)!==false && strpos($val,home_url())===false && !preg_match(‘/\.(jpg|jepg|png|ico|bmp|gif|tiff)/i’,$val)){
$content=str_replace(“href=\”$val\””, “href=\””.get_stylesheet_directory_uri().”/go.php?url=$val\” “,$content); //根据go文件的位置调整
}
}
}
return $content;
}
add_filter(‘the_content’,’loper_content_nofollow’,999);
/**
/* WordPress评论外链添加go跳转
*/
function loper_redirect_comment_link($text = ”){
$text = str_replace(‘href=”‘, ‘href=”‘ . get_stylesheet_directory_uri() . ‘/go.php?url=’, $text); //根据go文件的位置调整
$text = str_replace(“href='”, “href='” . get_stylesheet_directory_uri() . “/go.php?url=”, $text); //根据go文件的位置调整
return $text;
}
add_filter(‘get_comment_author_link’, ‘loper_redirect_comment_link’, 5);
add_filter(‘comment_text’, ‘loper_redirect_comment_link’, 99);

标签:WordPress跳转
分享这篇文章
Facebook Email Copy Link Print
By智诚云集 - Xyok.Cn
关注:
分销:阿里云、腾讯云、百度云、GoDaddy、景安云、Linode云服务器产品。
上一篇 Windows系统internet时间修改服务器解决时间不同步问题
下一篇 第77个日本投降纪念日!日本战败投降日!勿忘历史!

You Might Also Like

记录

十几年艾肯Icon声卡用户一直还有售后

博主这个艾肯icon…

2 Min Read
记录

DiscuzX 3.5 测试版下载(仅测试不建议用于升级)

很多Discuz站长…

3 Min Read
记录

WordPress通过数据库SQL命令快速执行批量删除垃圾评论

WordPress程…

3 Min Read
记录

wordpress用nofollow属性减少页面权重流失集中内页权重的方式

首先我们了解一下No…

2 Min Read
智诚云集智诚云集
关注我们
© Foxiz News Network. Ruby Design Company. All Rights Reserved.
Welcome Back!

Sign in to your account

Username or Email Address
Password

Lost your password?