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
檢視更多 >