``` //评论链接重写 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; } 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: ".bloginfo('url')."/"); exit; } } } add_action('init', 'redirect_comment_link'); add_filter('get_comment_author_link', 'add_redirect_comment_link', 5); add_filter('comment_text', 'add_redirect_comment_link', 99); ```