wpseek.com
WordPress开发者和主题制作者的搜索引擎



wp_get_comment_status › WordPress Function

Since1.0.0
已弃用n/a
wp_get_comment_status ( $comment_id )
参数:
  • (int|WP_Comment) $comment_id Comment ID or WP_Comment object
    Required: Yes
返回:
  • (string|false) Status might be 'trash', 'approved', 'unapproved', 'spam'. False on failure.
定义在:
文档:

Retrieves the status of a comment by comment ID.



源码

function wp_get_comment_status( $comment_id ) {
	$comment = get_comment( $comment_id );
	if ( ! $comment ) {
		return false;
	}

	$approved = $comment->comment_approved;

	if ( null == $approved ) {
		return false;
	} elseif ( '1' == $approved ) {
		return 'approved';
	} elseif ( '0' == $approved ) {
		return 'unapproved';
	} elseif ( 'spam' === $approved ) {
		return 'spam';
	} elseif ( 'trash' === $approved ) {
		return 'trash';
	} else {
		return false;
	}
}