get_edit_comment_link

函数
get_edit_comment_link ( $comment_id = 0 )
参数
  • (int|WP_Comment) $comment_id Optional. Comment ID or WP_Comment object.
    Required:
返回值
  • (string|void) The edit comment link URL for the given comment.
定义位置
相关方法
edit_comment_linkget_next_comments_linkget_comment_linkget_comments_linkget_edit_post_link
引入
2.3.0
弃用
-

get_edit_comment_link: 这个函数用来检索给定评论ID的编辑评论屏幕的URL。这可以用来生成链接或重定向到编辑评论屏幕。

读取编辑评论的链接。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function get_edit_comment_link( $comment_id = 0 ) {
$comment = get_comment( $comment_id );
if ( ! current_user_can( 'edit_comment', $comment->comment_ID ) ) {
return;
}
$location = admin_url( 'comment.php?action=editcomment&c=' ) . $comment->comment_ID;
/**
* Filters the comment edit link.
*
* @since 2.3.0
*
* @param string $location The edit link.
*/
return apply_filters( 'get_edit_comment_link', $location );
}
function get_edit_comment_link( $comment_id = 0 ) { $comment = get_comment( $comment_id ); if ( ! current_user_can( 'edit_comment', $comment->comment_ID ) ) { return; } $location = admin_url( 'comment.php?action=editcomment&c=' ) . $comment->comment_ID; /** * Filters the comment edit link. * * @since 2.3.0 * * @param string $location The edit link. */ return apply_filters( 'get_edit_comment_link', $location ); }
function get_edit_comment_link( $comment_id = 0 ) {
	$comment = get_comment( $comment_id );

	if ( ! current_user_can( 'edit_comment', $comment->comment_ID ) ) {
		return;
	}

	$location = admin_url( 'comment.php?action=editcomment&c=' ) . $comment->comment_ID;

	/**
	 * Filters the comment edit link.
	 *
	 * @since 2.3.0
	 *
	 * @param string $location The edit link.
	 */
	return apply_filters( 'get_edit_comment_link', $location );
}

常见问题

FAQs
查看更多 >