Skip to content

Instantly share code, notes, and snippets.

@soderlind
Created July 24, 2026 10:20
Show Gist options
  • Select an option

  • Save soderlind/9eb3e6b13260e79c89586ad4d602992b to your computer and use it in GitHub Desktop.

Select an option

Save soderlind/9eb3e6b13260e79c89586ad4d602992b to your computer and use it in GitHub Desktop.
WordPress Multisite: Use WP CLI to copy options from one subsite to another

Copy options from one subsite to another

# Read the RAW option value from the source site (bypasses the masking filter)
wp --path=/path/to/SOURCE option list --search='EXACT_OPTION_NAME' --field=option_value \
  | wp --path=/path/to/TARGET option update EXACT_OPTION_NAME

# Verify on the target with option list (NOT option get, which also runs the mask filter)
wp --path=/path/to/TARGET option list --search='EXACT_OPTION_NAME' --field=option_value

Notes:

  • Use option list --search=... --field=option_value, not option getoption get triggers the option_{name} filter and would for secrets copy the mask, not the value.
  • Match the exact option name (adjust --search if it's a substring of other option names).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment