get_comment_to_edit()
get_comment_to_edit( int $id )
基于注释ID返回WP_Comment对象。
Returns a WP_Comment object based on comment ID.
参数(Parameters)
参数 | 类型 | 必填 | 说明 |
---|---|---|---|
$id | (int) | 必需 | 要检索的注释的ID。 |
返回(Return)
(WP|Comment|false)如果找到,则注释。失败时为False。
源码(Source)
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
|
function get_comment_to_edit( $id ) { $comment = get_comment( $id ); if ( ! $comment ) { 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_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 ; } |
get_comment_to_edit() 为WP2原创文章,链接:https://www.wp2.cn/functions/get_comment_to_edit/