Submit a wp-admin settings form
submit_admin_formSubmit admin-only WordPress form settings with a safe two-step process. Preview changes first, confirm via token, then submit while automatically handling nonces and hidden fields. Refuses risky forms and unknown fields.
Instructions
Fill in and submit a form on a wp-admin screen as the administrator — the way to change plugin settings that live only on a wp-admin page with no REST route. First call is a dry run: it fetches the page, locates the form (by index or id), applies your changes on top of the current field values (hidden fields, nonce and referer included automatically; unchecked checkboxes handled correctly), and returns the diff of changed fields plus a confirm_token. Second call re-fetches the page for a fresh nonce, verifies the other field values have not changed since the preview, submits the form same-site, follows the redirect, and reports the resulting notices (e.g. "Settings saved.") and the new values. Unknown field names are refused with suggestions. Forms with file inputs, and screens that manage plugins/themes/users/exports/core updates, are refused — dedicated tools with proper guardrails exist for those.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| page | Yes | The wp-admin screen the form is on, e.g. "options-general.php" or "admin.php?page=wpseo_titles". | |
| changes | Yes | Field name → new value. Checkboxes accept true/false; selects and radios accept one of their option values. | |
| form_id | No | The form's HTML id, if it has one. An alternative to form_index. | |
| 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. | |
| form_index | No | Which form on the page (0-based). Use this or form_id. | |
| confirm_token | No | Token from the dry-run preview, required to actually submit. | |
| allow_sensitive | No | Permit changing a password-type field. Off by default; a dedicated tool is usually safer. | |
| force_incomplete_form | No | DANGEROUS: submit even though the completeness check found options the form would not send (options.php blanks them) or controls the parser missed. Only for a human-verified case; it can wipe plugin or site settings. |