wp_get_comment_status

Definition:
function wp_get_comment_status($comment_id) {}

The status of a comment by ID.

Parameters

  • int $comment_id: Comment ID

Return values

returns:Status might be ‘trash’, ‘approved’, ‘unapproved’, ‘spam’. False on failure.

Source code

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;

}

3695

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: