Skip to content

Instantly share code, notes, and snippets.

@davepullig
Last active April 24, 2023 06:26
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save davepullig/efddb9a894e0c4a824b4b61183cfb01c to your computer and use it in GitHub Desktop.
Save davepullig/efddb9a894e0c4a824b4b61183cfb01c to your computer and use it in GitHub Desktop.
WP CLI search and replace URLs for WordPress multisite
wp search-replace --network --url=website.dev website.dev website.tld --precise --all-tables
@mattiasghodsian
Copy link

If you are using subdirectories on multisite

wp search-replace  --network 'example.com' 'example.test'  --all-tables --dry-run 

then

wp search-replace  --network 'example.com' 'example.test'  --all-tables

@kayyumaquaint
Copy link

Hello @mattiasghodsian,
I have a network site with a subdirectory but now I want to change with subdomain so please how can I change with WP CLI.
My current domain is: https://swea.org.hemsida.eu/london
My new domain will be: https://london.swea.org

@mattiasghodsian
Copy link

Hello @mattiasghodsian, I have a network site with a subdirectory but now I want to change with subdomain so please how can I change with WP CLI. My current domain is: https://swea.org.hemsida.eu/london My new domain will be: https://london.swea.org

Did you try the dry run ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment