wp_approve_comment
Approve pending comments in WordPress to moderate discussions and publish user feedback on your site.
Instructions
Approves a pending comment.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| site | No | The ID of the WordPress site to target (from mcp-wordpress.config.json). Required if multiple sites are configured. | |
| id | Yes | The ID of the comment to approve. |
Implementation Reference
- src/tools/comments.ts:230-241 (handler)Executes the tool logic by updating the specified comment's status to 'approved' using the WordPressClient's updateComment method and returns a success message.public async handleApproveComment(client: WordPressClient, params: Record<string, unknown>): Promise<unknown> { const { id } = params as { id: number }; try { const comment = await client.updateComment({ id, status: "approved", }); return `✅ Comment ${comment.id} has been approved.`; } catch (_error) { throw new Error(`Failed to approve comment: ${getErrorMessage(_error)}`); } }
- src/tools/comments.ts:130-142 (registration)Registers the wp_approve_comment tool within the CommentTools.getTools() array, including schema definition and handler binding.{ name: "wp_approve_comment", description: "Approves a pending comment.", parameters: [ { name: "id", type: "number", required: true, description: "The ID of the comment to approve.", }, ], handler: this.handleApproveComment.bind(this), },