wp comment <command>

Creates, updates, deletes, and moderates comments.

In this article


# 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.

# Delete all spam comments.
$ wp comment delete $(wp comment list --status=spam --format=ids)
Success: Deleted comment 264.
Success: Deleted comment 262.


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.

Command documentation is regenerated at every release. To add or update an example, please submit a pull request against the corresponding part of the codebase.