Update a plugin's settings option
update_plugin_settingsPreview a plugin's setting changes as a dry run, then confirm to update the WordPress option, with backup and undo support.
Instructions
Write an option a plugin owns through WordPress's update_option(), so any sanitize callback attached to it runs. Caveat: plugins that register settings only inside wp-admin (Yoast does) have no sanitizer in this request — the preview warns, and for those the plugin's settings screen via submit_admin_form is the sanitized path. Pass changes to deep-merge fields into the existing option (the usual case for a settings array), or value to replace the whole option. The previous value is backed up (last five kept) and can be undone with restore_plugin_settings. The first call is a dry run: it returns the before→after diff (before sanitization — the plugin may adjust or drop values on save) and a confirm_token; re-run with that token to apply, and the result reports what the sanitizer changed. Options wpxmcp protects, and options not attributable to the plugin (unless force_option), are refused. Prefer a plugin's REST route or ability when inspect_plugin shows one.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| value | No | A complete replacement value for the option. Use instead of `changes`, not with it. | |
| option | Yes | The option name to write, e.g. "wpseo_titles". | |
| plugin | Yes | Plugin identifier (slug, dir/file, or name). | |
| changes | No | Fields to deep-merge into the existing option value (for array/object options). | |
| site_id | No | Which configured WordPress site to act on. Optional — with a single site configured it is used automatically; with several, the default site is used unless you name one. Run list_sites for valid ids. | |
| force_option | No | Write even when the option is not attributable to this plugin. Off by default as a guard against typos. | |
| confirm_token | No | Token from the dry-run preview, required to actually apply the write. |