WordPress实现评论者链接Go跳转
2018-01-22
none
未分类
将以下代码加入到主题function.php的 ?> 前
//评论者链接重定向 add_filter('get_comment_author_link', 'add_redirect_comment_link', 5); add_filter('comment_text', 'add_redirect_comment_link', 99); function add_redirect_comment_link($text = ''){ $text=str_replace('href="', 'href="'.get_option('home').'/go/?url=', $text); $text=str_replace("href='", "href='".get_option('home')."/go/?url=", $text); return $text; }
上传/go/到网站根目录
压缩包里的index.php文件里的网站自己更换修改。
在robots.txt 加入 Disallow: /go/禁止收录go跳转页面
点我下载文件