wp_get_comments: list comments

Lists comments, optionally filtered by post and status.

Arguments

Argument Default Meaning
post_id Restrict to one post
status all Comment status
page 1 Page number
per_page 20 Comments per page, clamped to 1–100

Permissions

mcp:read and wp:content:read, plus the moderate_comments capability.

Reading comments is a moderation permission, not a content one. Even approved comments visible to any visitor cannot be listed without it.

What it returns

items only — no total, as with taxonomy listings. Each comment carries id, post_id, author, content, status and date.

Since there is no total and per_page caps at 100, a listing cannot tell you how many comments exist beyond the page you fetched. On a site with an active comment section, plan to page.

The statuses

all is the default and includes approved, pending, spam and trashed comments together — which is rarely what you want.

Filter deliberately:

Status Shows
approve Published comments
hold The moderation queue
spam Marked as spam
trash Trashed

For the moderation queue specifically, wp_get_pending_comments is the same call with hold applied.

Reading comments transmits them

Comment content goes to the connected client, and comments frequently contain personal data — names, email addresses in the author field, phone numbers, order references, sometimes health or financial details in a support context.

That is inherent to moderating over MCP, and worth knowing before pointing an assistant at a busy comment section. See Audio privacy for the equivalent argument about dictation, and Understand data sent for AI processing generally.

Let the assistant summarise, not decide

The useful pattern:

Group these comments into obvious spam, probably genuine, and unclear. Do not approve, delete or mark anything.

Summarise the pending comments in one line each.

Then act on specific IDs yourself. Delegating "approve the genuine ones" hands over an editorial judgement about messages people wrote to you.

Auditing a specific post

List the comments on post 412 with their statuses.

Useful when a post is attracting spam, or when checking whether a discussion needs attention before you change the post itself.

Common problems

Symptom Cause
pom_ai_mcp_forbidden The acting user lacks moderate_comments
Spam and trash mixed into the results Default status is all
Fewer comments than expected per_page caps at 100 and there is no total
An empty result on a post with comments Wrong post_id, or all are in a status you filtered out

Related