wordpress 通过functions钩子去除评论中链接/评论日期时间/评论人的网站链接

作者: 站长 上传时间: 浏览: N/A 下载: N/A 格式: N/A 评分: N/A

// 删除评论内容中的链接
function mytheme_remove_url($arg) {
$arg['url'] = '';
return $arg;
}
add_filter('comment_form_default_fields', 'mytheme_remove_url');


// 删除评论日期
function wpb_remove_comment_date($date, $d, $comment) {
if ( !is_admin() ) {
return;
} else {
return $date;
}
}
add_filter( 'get_comment_date', 'wpb_remove_comment_date', 10, 3);

// 删除评论时间
function wpb_remove_comment_time($date, $d, $comment) {
if ( !is_admin() ) {
return;
} else {
return $date;
}
}
add_filter( 'get_comment_time', 'wpb_remove_comment_time', 10, 3);

// remove comment's edit button 删除评论编辑按钮
add_filter( 'sce_comment_time', 'edit_sce_comment_time' );
function edit_sce_comment_time( $time_in_minutes ) {
return 10;
}

//remove author link on comments 删除评论者的website url
function disable_comment_author_links( $author_link ){
return strip_tags( $author_link );
}
add_filter( 'get_comment_author_link', 'disable_comment_author_links' );

//修改wordpress评论中 “登录以回复”的默认登录链接
if ( ! function_exists( 't5_do_not_ask_for_comment_log_in' ) ) {
add_filter( 'comment_reply_link', 't5_do_not_ask_for_comment_log_in' );
function t5_do_not_ask_for_comment_log_in( $link ) {
if ( empty ( $GLOBALS['user_ID'] ) && get_option( 'comment_registration' ) ) {
return ''; // 修改为自己的链接
}
return $link;

}

Leave a Comment