Edit post text
wp_alter_postFind and replace text inside one field of a post (for example its content), without sending the whole content again. Supports regular expressions with regex set to true and modifiers in flags.
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": {
"ID": "<ID>",
"field": "<field>",
"search": "<search>",
"replace": "<replace>"
},
"name": "wp_alter_post"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ID | Yes | Post ID. | |
| field | Yes | Field to modify: post_content, post_excerpt, or post_title. | |
| flags | No | Optional PCRE modifier letters applied in regex mode, e.g. "i" (case-insensitive), "s" (dotall), "m" (multiline). Allowed: i, m, s, x, u, A, D, S, U, X, J. | |
| regex | No | Treat search as a regex pattern (default: false). | |
| search | Yes | Text to search for, or (with regex=true) a bare PCRE pattern without delimiters, e.g. <!-- /wp:paragraph -->\s*$ | |
| replace | Yes | Replacement text. In regex mode, backreferences like $1 / \1 are supported. |