wp comment <command>

Creates, updates, deletes, and moderates comments.

$ wp comment <command>


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.


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


--path=<path> Path to the WordPress files.

--url=<url> Pretend request came from given URL. In multisite, this argument is how the target site is specified.

--ssh=[<scheme>:][<user>@]<host|container>[:<port>][<path>] Perform operation against a remote server over SSH (or a container using scheme of "docker", "docker-compose", "vagrant").

--http=<http> Perform operation against a remote WordPress installation over HTTP.

--user=<id|login|email> Set the WordPress user.

--skip-plugins[=<plugins>] Skip loading all plugins, or a comma-separated list of plugins. Note: mu-plugins are still loaded.

--skip-themes[=<themes>] Skip loading all themes, or a comma-separated list of themes.

--skip-packages Skip loading all installed packages.

--require=<path> Load PHP file before running the command (may be used more than once).

--[no-]color Whether to colorize the output.

--debug[=<group>] Show all PHP errors and add verbosity to WP-CLI output. Built-in groups include: bootstrap, commandfactory, and help.

--prompt[=<assoc>] Prompt the user to enter values for all command arguments, or a subset specified as comma-separated values.

--quiet Suppress informational messages.