//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://www.jb51.net/");
exit;
}
}
}
//comments link redirect
add_filter('get_comment_author_link', 'add_redirect_comment_author_link', 5);
add_filter('comment_text', 'add_redirect_comment_text', 99);
function add_redirect_comment_author_link($text = ''){
$text=str_replace("href=",'href="javascript:window.location=',ereg_replace('href='[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]'',"0"", $text));return $text;
}
function add_redirect_comment_text($text = ''){
$text=str_replace("href=","href='javascript:window.location=",ereg_replace('href="[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]"',"0'", $text));return $text;
}
以上就是安达网络工作室关于《WordPress 评论者超链接实现重定向跳转的方法》的一些看法。更多内容请查看本栏目更多内容!
为何要用 get_term_link?: 新类型的分类是无奈用 <?php echo get_category_link( $category_id ); ?> 输入...
首先,你要在wp-content/plugins/下建设一个文件夹,文件夹的名字最好只由字母、数字、“-”和下...
友谊链接关于一个每个独立博客来说能够说是必需的,有不少人抉择在侧边栏退出友谊链接栏目,但建设一个独立...
WordPress 3.8 开端的全新设计的后盾支持多颜色抉择,默许有八种十分精巧的配色,能够让用户本人抉择。 对...
WordPress能够经过一系列的工夫日期函数来管制工夫日期的输入,上面引见几个罕用的函数:1、the_date_xml()...
用户登录后封闭登录页面 WordPress默许的登录页面是:http://WP目录/wp-login.php,登录后会主动跳转到:ht...