Moderate a comment
wp_moderate_commentSet one WordPress comment's moderation status to approve, hold, spam, or trash to moderate replies and handle unwanted discussion.
Instructions
Set the moderation status of one comment: approve marks it approved, hold sets it back to pending, spam marks it as spam, trash moves it to the trash. Returns {moderated: true, comment_id, status}, status being the one asked for: the answer does not confirm that WordPress stored it, and wp_get_comment shows the stored status. Needs moderate_comments and the right to edit this comment (edit_comment), which follows the right to edit its post. Approving shows the comment wherever the post's comments are public, and WordPress may notify the post's author. Where the site's trash is off (EMPTY_TRASH_DAYS 0), trash deletes the comment for good, as in WordPress; every other change can be reversed by a later call. Trashing a top-level note (comment_type note) also trashes its reply notes, and setting the note to approve or hold later does not bring those back. An unknown comment_id returns a not-found error. Deleting outright is done by wp_delete_comment.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| status | Yes | New status: approve, hold (pending), spam or trash. Other values are refused. | |
| comment_id | Yes | Id of the comment, as wp_list_comments returns it. |