
基于Laravel开发网站实时评论系统
wp_get_comment_status ( $comment_id )
wp_get_comment_status: 这个函数检索一个评论的状态。它接受评论ID作为参数,并返回一个包含评论状态的字符串。
通过评论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; } }