这是我爱水煮鱼的评论链接跳转代码,用这个听说可以防止sb的百度随便跟随目标,前提是你的主题函数符合一般的标准,那么把这段代码放进你的functions.php函数里面,再看看评论链接的时候就可以看到多了一个跳转的地址,而不是原来的地址了哦。
[cce_php] //我爱水煮鱼跳转代码 //comments link redirect //comments link redirect 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').'?r=', $text); $text=str_replace("href='", "href='".get_option('home')."?r=", $text); return $text; } add_action('init', 'redirect_comment_link'); function redirect_comment_link(){ $redirect = $_GET['r']; if($redirect){ if(strpos($_SERVER['HTTP_REFERER'],get_option('home')) !== false){ header("Location: $redirect"); exit; } else { header("Location: https://wp.qdkfweb.cn"); exit; } } } [/cce_php]
你这个是加在什么位置的呢?请指教!
2013-01-20 04:55你好,这个是放在主题的functions里面的。不懂可以发我邮件。
2013-01-20 19:02