Summery Summery

The status of a comment by ID.

Syntax Syntax

wp_get_comment_status( int|WP_Comment $comment_id )

Parameters Parameters


(int|WP_Comment) (Required) Comment ID or WP_Comment object

Return Return

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

Source Source

File: wp-includes/comment.php

		return false;

	 * Fires immediately before a comment is marked as Spam.
	 * @since 2.9.0
	 * @since 4.9.0 Added the `$comment` parameter.
	 * @param int        $comment_id The comment ID.
	 * @param WP_Comment $comment    The comment to be marked as spam.
	do_action( 'spam_comment', $comment->comment_ID, $comment );

	if ( wp_set_comment_status( $comment, 'spam' ) ) {
		delete_comment_meta( $comment->comment_ID, '_wp_trash_meta_status' );
		delete_comment_meta( $comment->comment_ID, '_wp_trash_meta_time' );
		add_comment_meta( $comment->comment_ID, '_wp_trash_meta_status', $comment->comment_approved );
		add_comment_meta( $comment->comment_ID, '_wp_trash_meta_time', time() );

		 * Fires immediately after a comment is marked as Spam.


Changelog Changelog

Version Description
1.0.0 Introduced.


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.