//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 评论者超链接实现重定向跳转的方法》的一些看法。更多内容请查看本栏目更多内容!
置信接触过WP零碎的冤家都理解,老版零碎的上传图片门路是默许指向wp-content目录下的。做过WP博客的冤家应...
wordpress在默许状况下,头部会呈现很多平常用不到的html代码,比方: 复制代码代码如下: <link rel="altern...
让媒体库支持pdf分类 这段来自tutsplus的代码能够协助咱们完成如上图所示的成果,将代码放到主题的function...
通常咱们喜爱应用Wordpress Thread Comment 或 Mail To Commenter这两款插件前者久未更新,已测支持WordPre...
一 wordpress装置 我用的是XAMPP(Apache+MySql+PHP),wordpress(BLOG顺序)3.5.1 简体中武官方装置版...
上一篇,咱们应用 Meta Box 为文章增加了一个“推荐指数”字段。增加后用了一段工夫,仿佛不那么...