Inicio - Documentación - POM AI - 15 MCP - WordPress comment and meta tools - `wp_delete_comment`: delete a comment

wp_delete_comment: delete a comment

Removes a comment permanently. It does not go to the trash.

Arguments

Argument Required Meaning
comment_id Yes The comment
dry_run No Report without deleting

Permissions

Allow content writes open, and moderate_comments.

There is no trash step

Unlike the WordPress admin's delete, which usually trashes first, this tool removes the comment outright. Recovery means a database backup.

wp_trash_comment is the reversible equivalent, and it is the right choice for almost everything.

When deletion is genuinely the right action

Three cases, and they are narrow:

A data erasure request. Someone has asked for their personal data to be removed and you have decided the request is valid. Trashing does not satisfy that; the content stays in the database.

Content that must not remain on the server. Illegal material, or something your legal obligations require you to remove rather than hide.

A comment you created by mistake with wp_create_comment and want gone entirely.

Everything else — spam, off-topic, abusive, duplicate — is better served by spam or trash.

Erasure requests are not a delegation

If you are deleting because of a data request, that is a decision with legal weight. Make it yourself, record that you made it, and follow whatever procedure your organisation has.

Do not phrase it as an instruction an assistant interprets:

Delete comment 4433.

Not:

Delete the comments containing personal data.

The second asks the assistant to identify personal data across a comment section and act irreversibly on its judgement.

Read it before deleting

The dry run reports the comment ID and the action — not the content. So it confirms you have the right argument, not the right comment.

Show me comment 4433 in full. Then delete it.

For an erasure request in particular, you want to have seen exactly what is being removed, and ideally to have recorded it somewhere appropriate before it is gone.

What it returns

Whether the deletion succeeded.

Never delegate the criterion

The strongest form of the rule in this chapter. A criterion-based deletion of comments combines three bad properties: irreversible, applied to other people's words, and based on a judgement the assistant cannot make.

Name one ID at a time.

After deleting

  • The comment is gone from the post and the database.
  • Purge the cache — a cached page can still show it, which is confusing during an erasure request.
  • Check the comment count on the post if your theme shows one.

Common problems

Symptom Cause
The write is refused Content write gate closed
pom_ai_mcp_forbidden No moderate_comments
It cannot be recovered Correct; there is no trash step
The comment still appears Cached
More was deleted than intended A criterion was delegated

Related