Appearance
Preview and Run a Database Search and Replace
The wp_privileged_search_replace_run tool is off by default. Enable it only for a trusted connection, and always preview the changes before writing to the database.
In this article
Preview the Changes
In your AI client, ask it to call wp_privileged_search_replace_run with the text to find as old, the replacement text as new, and dry_run: true. A preview does not write changes to the database.
Review the preview before continuing. Check the affected tables, columns, cells, and occurrences to confirm the results are within the scope you intend to change. The preview also reports whether reversing the replacement would restore the original values exactly.
Apply the Changes
After reviewing the preview, ask your AI client to repeat the same request with the same old, new, and scope values, changing only dry_run to false. This writes the replacement to the database.
If the tool returns a job_id, use that ID to poll the background job until it reports that the work is complete.
No automatic undo: The tool does not automatically undo a completed replacement. The preview's report about whether a reverse replacement would restore the original values is not an undo or restore function.
Limits and Multisite Scope
By default, the tool skips Easy MCP AI tables, password data, and post GUIDs. It preserves supported serialized data, which is structured data stored in a format WordPress can read.
On a multisite network, check that the preview covers the intended site scope. When applying the changes, repeat the same scope values so the write request does not use a different scope from the preview.