wp_update_widget
Updates text, custom_html, block, or an existing woocommerce_recently_viewed_products widget without moving it. Recently viewed accepts title string and number integer (1–15); empty browsing history produces no output. Text accepts title/text strings and filter/visual booleans; custom_html accepts title/content strings; block requires complete replacement content. Omitted settings and metadata are preserved. Verify the rendered page in the same browsing session.
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": {
"site_id": "<site_id>",
"sidebar_id": "<sidebar_id>",
"widget_id": "<widget_id>",
"settings": "<settings>"
},
"name": "wp_update_widget"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| site_id | Yes | The connected site's id returned by list_sites. Call list_sites first; do not use a URL or WordPress post ID. | |
| settings | Yes | JSON-encoded object of widget settings to update (e.g. "{\"title\":\"My Widget\",\"text\":\"Hello\"}"). | |
| widget_id | Yes | The persisted widget instance ID (e.g. "text-2", "custom_html-4", "block-19"), not an editor preview ID. | |
| sidebar_id | Yes | The sidebar/widget area ID (from wp_list_widget_areas). |