WPDev.one
Core Function
View Source on Trac ↗

wp_set_comment_status()

wp_set_comment_status( mixed $comment_id, mixed $comment_status, mixed $wp_error = false )

Sets the status of a comment.

Parameters 2 required

Name / Type Description
(int

| WP_Comment) $comment_id Comment ID or WP_Comment object.

Required
$comment_status
string

New comment status, either 'hold', 'approve', 'spam', or 'trash'.

Required
$wp_error
bool

Whether to return a WP_Error object if there is a failure. Default false.

Return Value

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

Function Information

Since Version
1.0.0
Source File
wp-includes/comment.php
Advertisement