//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 评论者超链接实现重定向跳转的方法》的一些看法。更多内容请查看本栏目更多内容!
comments_template()(获取评论模板) comments_template() 函数用来获取评论模板,普通只能用在文章或许页...
老鹰主机,是咱们站长应用较多的美国主机商之一。有些时分,咱们可能习气国际的一些主机商和管制面板的建站...
目前.htaccess 文件的次要成绩是RewriteCond 指令性地反省磁盘文件能否存在,就算基本不需求反省,每一次拜...
WordPress 上获取文章最重要的就是循环(Loop),现实上循环就是去数据库查问到相应的文章,而后临时贮存到...
找到wp-includes/formatting.php文件中复制代码代码如下:// This is not a tag, nor is the texturization ...
本文实例讲述了WordPress屏蔽评论中链接地址的办法。分享给大家供大家参考。详细剖析如下: 应用WordPress做...