Abilities

List Comments

lh-comment-moderation/list-comments Read-only Idempotent

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

ParameterTypeRequiredDefaultDescription
post_idintegerNoOnly comments on this post.
statusstringNo"all"all (default): approved and held. approve, hold, spam or trash: only that status. One of: all, approve, hold, spam, trash.
searchstringNoText to find in the comment, author name, email, URL or IP.
author_emailstringNoOnly comments with exactly this author email.
per_pageintegerNo20Comments per page, up to 100.
pageintegerNo1Page number, from 1.
site_idintegerNoOptional. 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.

Moderate Comments

lh-comment-moderation/moderate-comments Idempotent

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.

ParameterTypeRequiredDefaultDescription
idsarray of integerYesComment IDs, up to 200.
actionstringYesapprove, 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_idintegerNoOptional. 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_tokenstringNoOptional. The claim_token from claim-next-task for task_id. Required when task_id is given.
site_idintegerNoOptional. 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.

Set Discussion

lh-comment-moderation/set-discussion Idempotent

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.

ParameterTypeRequiredDefaultDescription
post_idsarray of integerYesPost IDs, up to 200.
comment_statusstringYesopen or closed. One of: open, closed.
ping_statusstringNoOptional. open or closed for pingbacks and trackbacks. Omit to leave it as it is. One of: open, closed.
task_idintegerNoOptional. 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_tokenstringNoOptional. The claim_token from claim-next-task for task_id. Required when task_id is given.
site_idintegerNoOptional. 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.