execute_php
Run arbitrary PHP inside the full WordPress runtime to query data, call plugin APIs, or inspect returned values as a universal fallback.
Instructions
Execute arbitrary PHP in the full WordPress runtime ($wpdb, WP_Query, get_option, WooCommerce, every loaded plugin API). Do NOT include <?php tags. Use return $value; to return data for inspection; echoed output is captured separately. This is the universal fallback for anything the dedicated tools do not cover.
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>"
},
"name": "execute_php"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | PHP code to run. No <?php tags. Return a value to inspect it. |