Skip to main content
Glama

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
NameRequiredDescriptionDefault
siteNoThe ID of the WordPress site to target (from mcp-wordpress.config.json). Required if multiple sites are configured.
idYesThe ID of the comment to approve.

Implementation Reference

  • 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)}`); } }
  • 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), },

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/docdyhr/mcp-wordpress'

If you have feedback or need assistance with the MCP directory API, please join our Discord server