Change a widget
wp_update_widgetUpdates an existing WordPress widget instance by merging provided settings while applying the widget's sanitization and update filters; invalid IDs, widget types, or value shapes are rejected without saving.
Instructions
Update the settings of an existing widget instance (merges the given fields at the top level; a nested value sent replaces the stored one). The merged instance passes the widget's own update() sanitisation and the widget_update_callback filter, the same as the widgets screen — so HTML is filtered unless the account may post unfiltered HTML. A value that wp_get_widgets leaves out as a credential stays as stored when it is left out, also inside nested settings, and the answer leaves it out too. Returns updated, id and the stored settings. An unknown id, an unregistered widget type or a value in a shape the widget does not keep is refused, and nothing is saved. No undo point is recorded.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Widget id "<id_base>-<number>" as wp_get_widgets lists it, e.g. "text-2". | |
| settings | Yes | Fields to merge into the instance, e.g. {"title":"…","text":"…"}. Values: text, numbers, true, false, null, or lists nested no deeper than the widget already keeps that field. |