validate_php
Validate PHP code against WordPress coding standards to catch hook misuse, security gaps, deprecated functions, and anti-patterns before deployment in plugins or themes.
Instructions
Validate PHP code against WordPress coding standards and best practices. Checks for: correct hook usage, security issues (nonces, escaping, sanitization), deprecated functions, common anti-patterns, proper function prefixing. Context options: plugin, theme, mu-plugin, functions-php, general.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"code": "<code>",
"conversationId": "<conversationId>"
},
"name": "validate_php"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | The PHP code block to validate. Include the full code, not just a snippet. | |
| context | No | The context in which this PHP code is used. Affects which rules are applied. | general |
| revision | No | Revision number when re-validating. Increment this when submitting updated code. | |
| artifactId | No | If re-validating a previously validated code block, pass the same artifactId. | |
| conversationId | Yes | The conversation ID obtained from learn_wordpress_api. |