Replace Text in a Setting


Changes one passage of text inside a named site setting. Settings that control how the site loads, who may do what, or how sessions are signed can never be changed this way and are refused by name. Refused too when the value is PHP-serialized, or when the change would break JSON that is currently valid. Prefer the ability that owns a setting where one exists, for example the site settings abilities for the title or tagline.

Also known as: find and replace in settings, change the wording of a setting, edit option text.

Property Value
Ability slug mosmcp/content-replace-in-option
Wire tool name mosmcp__content-replace-in-option
Category Content Editing (mosmcp-content-editing)
Plan Free

 

Required access

Requirement Value
Capability manage_options
Minimum default role Administrator
Annotations readOnly: false · destructive: false · idempotent: false · openWorld: false

 

Input schema

Field Type Required Default Description
option string Yes — The exact name of the setting to edit.
find_text string Yes — The existing wording to replace. Get this from mosmcp/content-find-in-options.
replace_with string Yes — The new wording. Pass an empty string to delete the found text. HTML is saved the way the WordPress editor saves it: a user with the unfiltered_html capability can save any markup, including forms, scripts and styles, and markup a user is not allowed to save is refused with the reason rather than silently removed. Backslashes are kept.
replace_all boolean false Change every occurrence instead of requiring exactly one.

 

Output schema

Field Type Required Description
target string Yes What was edited, for example "post 12 post_content".
changed boolean Yes
occurrences integer Yes How many occurrences were replaced.
match_mode string How the text was matched. Anything other than "exact" means the stored wording differed from what was asked for, so the result is worth checking.
length_before integer
length_after integer
stored_verbatim boolean False when the site altered the text on the way in, which means the stored value now differs from what was sent.
notes string[]

 

Example

Sample prompt
Update the footer copyright setting from 2025 to 2026.

Example request (json)

{
  "jsonrpc": "2.0",
  "id": 156,
  "method": "tools/call",
  "params": {
    "name": "mosmcp__content-replace-in-option",
    "arguments": {
      "input": {
        "option": "footer_copyright",
        "find_text": "2025",
        "replace_with": "2026"
      }
    }
  }
}

Example response (json)

{
  "jsonrpc": "2.0",
  "id": 156,
  "result": {
    "isError": false,
    "structuredContent": {
      "target": "setting \"footer_copyright\"",
      "changed": true,
      "occurrences": 1,
      "match_mode": "exact",
      "length_before": 42,
      "length_after": 42,
      "stored_verbatim": true,
      "notes": []
    }
  }
}

 

Edge cases / errors

  • Protected setting (siteurl, home, active_plugins, template, wp_user_roles, admin_email, default_role, auth keys and salts ...) → mosmcp_option_protected; names with non-printable characters → mosmcp_option_name_not_printable.
  • Setting doesn't exist → mosmcp_option_not_found; serialized → mosmcp_serialized_value; not text → mosmcp_option_not_text.
  • Change would break valid JSON → mosmcp_json_would_break; text appears several times without replace_all → mosmcp_multiple_matches.

 


<< Previous Next >>
Replace Text in a Post Delete Block

For more information about the Secure MCP Server for WordPress plugin, explore the following resources:

Product Overview | Pricing | Try for Free | Documentation

If you have any questions regarding plugin configuration, pricing plans or licensing, please contact us or mail us at aisupport@xecurify.com.