Examples
# Create a new comment.
$ wp comment create --comment_post_ID=15 --comment_content="hello blog" --comment_author="wp-cli"
Success: Created comment 932.
# Update an existing comment.
$ wp comment update 123 --comment_author='That Guy'
Success: Updated comment 123.
# Delete an existing comment.
$ wp comment delete 1337 --force
Success: Deleted comment 1337.
# Trash all spam comments.
$ wp comment delete $(wp comment list --status=spam --format=ids)
Success: Trashed comment 264.
Success: Trashed comment 262.
# Create a note for a block (WordPress 6.9+).
$ wp comment create --comment_post_ID=15 --comment_content="This block needs revision" --comment_author="editor" --comment_type="note"
Success: Created comment 945.
# List notes for a specific post (WordPress 6.9+).
$ wp comment list --type=note --post_id=15
+------------+---------------------+----------------------------------+
| comment_ID | comment_date | comment_content |
+------------+---------------------+----------------------------------+
| 945 | 2024-11-10 14:30:00 | This block needs revision |
+------------+---------------------+----------------------------------+
# Reply to a note (WordPress 6.9+).
$ wp comment create --comment_post_ID=15 --comment_content="Updated per feedback" --comment_author="editor" --comment_type="note" --comment_parent=945
Success: Created comment 946.
# Resolve a note by adding a comment with status meta (WordPress 6.9+).
$ wp comment create --comment_post_ID=15 --comment_content="Resolving" --comment_author="editor" --comment_type="note" --comment_parent=945 --porcelain
947
$ wp comment meta add 947 _wp_note_status resolved
Success: Added custom field.
# Reopen a resolved note (WordPress 6.9+).
$ wp comment create --comment_post_ID=15 --comment_content="Reopening for further review" --comment_author="editor" --comment_type="note" --comment_parent=945 --porcelain
948
$ wp comment meta add 948 _wp_note_status reopen
Success: Added custom field.
Subcommands
| Name | Description |
|---|---|
| wp comment approve | Approves a comment. |
| wp comment count | Counts comments, on whole blog or on a given post. |
| wp comment create | Creates a new comment. |
| wp comment delete | Deletes a comment. |
| wp comment exists | Verifies whether a comment exists. |
| wp comment generate | Generates some number of new dummy comments. |
| wp comment get | Gets the data of a single comment. |
| wp comment list | Gets a list of comments. |
| wp comment meta | Adds, updates, deletes, and lists comment custom fields. |
| wp comment recount | Recalculates the comment_count value for one or more posts. |
| wp comment spam | Marks a comment as spam. |
| wp comment status | Gets the status of a comment. |
| wp comment trash | Trashes a comment. |
| wp comment unapprove | Unapproves a comment. |
| wp comment unspam | Unmarks a comment as spam. |
| wp comment untrash | Untrashes a comment. |
| wp comment update | Updates one or more comments. |