get_comment_to_edit() - WordPress 函数参考中文文档

返回介绍

get_comment_to_edit()

发布于 2017-09-10 字数2029 浏览 879 评论 0

get_comment_to_edit( int $id )

Returns a WP_Comment object based on comment ID.


描述


参数

$id

(int)
(Required)
ID of comment to retrieve.


返回值

(WP_Comment|false) Comment if found. False on failure.


源代码

File: wp-admin/includes/comment.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;
}

更新日志

Version 描述
2.0.0 Introduced.

相关函数

Uses

  • wp-admin/includes/comment.php:
    comment_edit_pre
  • wp-includes/formatting.php:
    esc_url()
  • wp-includes/formatting.php:
    format_to_edit()
  • wp-includes/plugin.php:
    apply_filters()
  • wp-includes/comment.php:
    get_comment()

User Contributed Notes

上一篇:get_comment_time()

下一篇:WP_Comment

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

目前还没有任何评论,快来抢沙发吧!