Uses
Uses | Description |
---|---|
wp-includes/comment.php: get_comment() | Retrieves comment data given a comment ID or comment object. |
The status of a comment by ID.
(int|WP_Comment) (Required) Comment ID or WP_Comment object
(string|false) Status might be 'trash', 'approved', 'unapproved', 'spam'. False on failure.
File: wp-includes/comment.php
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; } }
Version | Description |
---|---|
1.0.0 | Introduced. |
© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/wp_get_comment_status