wp_get_comment_status()
wp_get_comment_status( int|WP_Comment $comment_id ) 按ID…
wp_get_comment_status( int|WP_Comment $comment_id )
按ID列出的注释的状态。
The status of a comment by ID.
目录锚点:#参数#源码#笔记
参数(Parameters)
| 参数 | 类型 | 说明 |
|---|---|---|
| $comment_id | (int | WP_Comment) | 注释ID或WP_注释对象 |
源码(Source)
/**
* The status of a comment by ID.
*
* @since 1.0.0
*
* @param int $comment_id Comment ID
* @return false|string Status might be 'trash', 'approved', 'unapproved', 'spam'. False on failure.
*/
function wp_get_comment_status($comment_id) {
$comment = get_comment($comment_id);
if ( !$comment )
return false;
$approved = $comment->comment_approved;
if ( $approved == null )
return false;
elseif ( $approved == '1' )
return 'approved';
elseif ( $approved == '0' )
return 'unapproved';
elseif ( $approved == 'spam' )
return 'spam';
elseif ( $approved == 'trash' )
return 'trash';
else
return false;
}| 更新版本 | 源码位置 | 使用 | 被使用 |
|---|---|---|---|
| 1.0.0 | wp-includes/comment.php | 9 | 7 |
笔记(Notes)
检查评论是否被批准
类别:WordPress 函数手册、
本文收集自互联网,转载请注明来源。
如有侵权,请联系 wper_net@163.com 删除。

还没有任何评论,赶紧来占个楼吧!