wp_patch_template
Edit a template (header/footer/…) IN PLACE by element id — change one value (spacing, a color, hide-on-mobile) WITHOUT rebuilding it. Same op grammar as wp_patch_page: ops = JSON array of {node_id, field, new_value} or {node_id, style:{…}} (classic elements; style Editor V4 elements with wp_v4_style). Get the template id from wp_list_templates, then read its node ids with wp_get_page(post_id=template_id). dry_run previews the diff. Writes-gated, plugin transport, Xyle Connector v0.6.0+.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ops | Yes | JSON array of {node_id, field, new_value} or {node_id, style:{…}}. Editor V4 atomic: prop names (title, paragraph, text, tag, link, image) with bare values are enveloped automatically; {node_id: <e-tabs id>, tabs: {labels, active, order}} rewrites a tabs element keeping panel content. Every patch also types V4 text the Elementor editor showed blank; ops=[] does only that. | |
| dry_run | No | Preview the diff without writing | |
| site_id | Yes | The WordPress site ID | |
| template_id | Yes | The template post ID (from wp_list_templates) |