根据注释ID返回WP_Comment对象。

原型

get_comment_to_edit( int $id )

参数

$id (int) (Required) 要检索的注释的ID。

返回值

(WP_Comment|false)  评论如果找到。失败时是假的。

源文件

路径:wp-admin/includes/comment.php

<?php
...
function get_comment_to_edit( $id ) {
	if ( !$comment = get_comment($id) )
		return false;
	$comment->comment_ID = (int) $comment->comment_ID;
	$comment->comment_post_ID = (int) $comment->comment_post_ID;
	$comment->comment_content = format_to_edit( $comment->comment_content );
	/**
	 * Filters the comment content before editing.
	 *
	 * @since 2.0.0
	 *
	 * @param string $comment->comment_content Comment content.
	 */
	$comment->comment_content = apply_filters( 'comment_edit_pre', $comment->comment_content );
	$comment->comment_author = format_to_edit( $comment->comment_author );
	$comment->comment_author_email = format_to_edit( $comment->comment_author_email );
	$comment->comment_author_url = format_to_edit( $comment->comment_author_url );
	$comment->comment_author_url = esc_url($comment->comment_author_url);
	return $comment;
}
...
?>

其他

英文文档:https://developer.wordpress.org/reference/functions/get_comment_to_edit/