list-comments List Commentsmoderate-comments Moderate Commentsset-discussion Set DiscussionLists comments for moderation, newest first, filtered by post, status, search text or author email. Each comment comes with id, post_id, type (comment, pingback or trackback), author, author_email, date (site-local Y-m-d H:i:s), status (approve, hold, spam or trash) and a plain-text excerpt of up to 40 words. status all, the default, is approved plus held comments, as in wp-admin; ask for spam or trash by name. search matches the comment text, author name, email, URL and IP. Pages of up to 100; total and total_pages give the full count. Pass the ids to moderate-comments to act on them. Requires moderate_comments. Pass site_id to act on another site you belong to.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
post_id | integer | No | Only comments on this post. | |
status | string | No | "all" | all (default): approved and held. approve, hold, spam or trash: only that status. One of: all, approve, hold, spam, trash. |
search | string | No | Text to find in the comment, author name, email, URL or IP. | |
author_email | string | No | Only comments with exactly this author email. | |
per_page | integer | No | 20 | Comments per page, up to 100. |
page | integer | No | 1 | Page number, from 1. |
site_id | integer | No | Optional. ID of another site in the network to act on; list-my-sites gives the sites you belong to. Permissions are checked on that site. Omit for this site. |
Approves, unapproves, spams, unspams, trashes or untrashes up to 200 comments in one call, returning a result per comment. Every comment gets its own result: changed, unchanged (already in that state, or nothing to undo) or error, with status_before, status_after and a message, so one bad ID never stops the rest. Nothing is ever deleted: trash is the furthest it goes, and trash is refused when the site has trash disabled. A spam or trashed comment must be unspammed or untrashed before it can be approved or unapproved. Each change is recorded in the audit trail. Find IDs with list-comments. Each comment also needs edit_comment. Requires moderate_comments. Pass site_id to act on another site you belong to.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
ids | array of integer | Yes | Comment IDs, up to 200. | |
action | string | Yes | approve, unapprove (hold for moderation), spam, unspam (restores the status before it was spammed), trash or untrash (restores the status before it was trashed). One of: approve, unapprove, spam, unspam, trash, untrash. | |
task_id | integer | No | Optional. The lh-tasks task this call is working on. Pass with claim_token: the call is refused unless you hold that claim, and a successful call renews it. | |
claim_token | string | No | Optional. The claim_token from claim-next-task for task_id. Required when task_id is given. | |
site_id | integer | No | Optional. ID of another site in the network to act on; list-my-sites gives the sites you belong to. Permissions are checked on that site. Omit for this site. |
Opens or closes comments, and optionally pingbacks and trackbacks, on up to 200 posts of any type, returning a result per post. Sets each post's comment_status and, when ping_status is given, its ping_status; existing comments are left as they are, so use moderate-comments for those. Each result is changed, unchanged or error, with the before and after settings and comments_open, which is whether comments are actually open now: it can be false on an open post when the site closes comments on older posts. Each change is recorded in the audit trail. Each post also needs edit_post. Requires moderate_comments. Pass site_id to act on another site you belong to.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
post_ids | array of integer | Yes | Post IDs, up to 200. | |
comment_status | string | Yes | open or closed. One of: open, closed. | |
ping_status | string | No | Optional. open or closed for pingbacks and trackbacks. Omit to leave it as it is. One of: open, closed. | |
task_id | integer | No | Optional. The lh-tasks task this call is working on. Pass with claim_token: the call is refused unless you hold that claim, and a successful call renews it. | |
claim_token | string | No | Optional. The claim_token from claim-next-task for task_id. Required when task_id is given. | |
site_id | integer | No | Optional. ID of another site in the network to act on; list-my-sites gives the sites you belong to. Permissions are checked on that site. Omit for this site. |