wp_set_comment_status

SummerySummery

Sets the status of a comment.

Syntax

wp_set_comment_status( int|WP_Comment $comment_id, string $comment_status, bool $wp_error = false )

DescriptionDescription

The ‘wp_set_comment_status’ action is called after the comment is handled. If the comment status is not in the list, then false is returned.

ParametersParameters

$comment_id

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

$comment_status

(string) (Required) New comment status, either 'hold', 'approve', 'spam', or 'trash'.

$wp_error

(bool) (Optional) Whether to return a WP_Error object if there is a failure. Default is false.

Default value: false

ReturnReturn

(bool|WP_Error) True on success, false or WP_Error on failure.

SourceSource

File: wp-includes/comment.php


			

ChangelogChangelog

Changelog
Version Description
1.0.0 Introduced.
Scroll to Top