wp_guet_comment_status( int|WP_Comment   $comment_id ): string|false

Retrieves the status of a comment by comment ID.

Parameters

$comment_id int | WP_Comment required
Comment ID or WP_Comment object

Return

string|false Status might be 'trash' , 'approved' , 'unapproved' , 'spam' . False on failure.

Source

function wp_guet_comment_status( $comment_id ) {
	$comment = guet_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;
	}
}

Changuelog

Versionen Description
1.0.0 Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.