//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 评论者超链接实现重定向跳转的方法》的一些看法。更多内容请查看本栏目更多内容!
由于用户寻觅的是相干的文章,不相干的文章是没有多大兴味看,博客吧以为这样也能进步PVwordpress显示以后文...
WordPress 简码是一品种似于论坛标签的货色,格局相似于把尖括号换成中括号的 Html 标签。简码很多人叫做短...
chrome阅读器为什么比普通的阅读器快呢?缘由是chrome阅读器给全副页面都弄了预加载性能。 目前可能还是有少...
因为Google被彻底墙掉,不翻墙就无奈加载谷歌字体。很多老手冤家常常埋怨本人买的主机如何如何慢,给的示例...
esc_html()(本义 Html) esc_html() 函数用来本义 Html 代码,让 Html 代码不本义。 用法 esc_html( $tex...
第一种办法:我的这个博客不断都在网上运转,明天想把它在本地架设一个,包括数据库都和网上的如出一辙。详...