Un motore di ricerca WordPress per sviluppatori e autori di temi



wp_get_comment_status ›

Da1.0.0
Deprecaton/a
wp_get_comment_status ( $comment_id )
Parametri:
  • (int|WP_Comment) $comment_id Comment ID or WP_Comment object
    Richiesto:
Ritorna:
  • (false|string) Status might be 'trash', 'approved', 'unapproved', 'spam'. False on failure.
Definito a:
Codex:

The status of a comment by ID.



Sorgenti

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;
	}
}