A command line interface for WordPress

Commands » comment

wp comment - Manage comments.

Quick links: Github issues


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


Name Description
approve Approve a comment.
count Count comments, on whole blog or on a given post.
create Create a new comment.
delete Delete a comment.
exists Verify whether a comment exists.
generate Generate some number of new dummy comments.
get Get data of a single comment.
list Get a list of comments.
meta Manage comment custom fields.
recount Recalculate the comment_count value for one or more posts.
spam Mark a comment as spam.
status Get status of a comment.
trash Trash a comment.
unapprove Unapprove a comment.
unspam Unmark a comment as spam.
untrash Untrash a comment.
update Update one or more comments.