You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe your use case and the problem you are facing
As discussed during the WP-CLI office hours chat today (discussion starts here), several people expressed interest in a command that specifically handles changing the domain name of a site. Currently wp search-replace can be used for this but there are pitfalls, for example if the search value is a substring of the replacement then the command cannot be repeated without causing further unwanted replacements, and being able to reliably replace all instances of full URLs.
Introduce a dedicated command for changing the domain name of a site which performs a search and replace across the database, but with more knowledge of the underlying data structure used by WordPress to avoid pitfalls mentioned above and to be as fast as possible.
Lots to consider here, I'll add notes to this issue that were raised during the chat.
Considerations
Handling the scheme. Need options for ignoring the scheme, and forcing it to https or http.
Input format. Does this just accept a host name or a URL including scheme?
Multisite behaviour. Will this be a network-wide change by default?
Which core tables and columns should be included by default? Assuming all others can be ignored because they'll never contain a domain name.
wp_commentmeta.meta_value
wp_comments.comment_author - maybe
wp_comments.comment_author_email
wp_comments.comment_author_url
wp_comments.comment_content
wp_links.link_url
wp_options.option_value
wp_postmeta.meta_value
wp_posts.post_content
wp_posts.post_title - maybe
wp_posts.post_excerpt
wp_posts.post_content_filtered
wp_posts.guid - see notes below
wp_terms.name - maybe
wp_termmeta.meta_value
wp_usermeta.meta_value
wp_users.user_email - see notes below
wp_users.user_url
wp_users.display_name - maybe
Any others?
Non-core database tables. Included by default? Likely yes.
GUIDs. There's a use case for both changing these and retaining them.
Email addresses. Same as above.
Subdomain (or possibly more generally, substring) matching behaviour. If you want to replace example.com with mydev.localhost, should subdomain.example.com be affected or not?
Considerations outside of the database, eg. any of the constants in wp-config.php.
Use the current site address or the domain in --url as the "from" domain, is there a need for it to be included as a separate flag in the command?
What about broken sites?
What about importing a database from elsewhere and WP_HOME and WP_SITEURL are defined in the config with a different domain.
The text was updated successfully, but these errors were encountered:
As it stands this issue feels quite epic to me (and probably others) and hence feels intimidating. Since it's been some time without any movement - can this maybe be broken up into smaller chunks so it is easier to tackle?
Describe your use case and the problem you are facing
As discussed during the WP-CLI office hours chat today (discussion starts here), several people expressed interest in a command that specifically handles changing the domain name of a site. Currently
wp search-replace
can be used for this but there are pitfalls, for example if the search value is a substring of the replacement then the command cannot be repeated without causing further unwanted replacements, and being able to reliably replace all instances of full URLs.Related links:
Describe the solution you'd like
Introduce a dedicated command for changing the domain name of a site which performs a search and replace across the database, but with more knowledge of the underlying data structure used by WordPress to avoid pitfalls mentioned above and to be as fast as possible.
Lots to consider here, I'll add notes to this issue that were raised during the chat.
Considerations
https
orhttp
.wp_commentmeta.meta_value
wp_comments.comment_author
- maybewp_comments.comment_author_email
wp_comments.comment_author_url
wp_comments.comment_content
wp_links.link_url
wp_options.option_value
wp_postmeta.meta_value
wp_posts.post_content
wp_posts.post_title
- maybewp_posts.post_excerpt
wp_posts.post_content_filtered
wp_posts.guid
- see notes belowwp_terms.name
- maybewp_termmeta.meta_value
wp_usermeta.meta_value
wp_users.user_email
- see notes belowwp_users.user_url
wp_users.display_name
- maybeexample.com
withmydev.localhost
, shouldsubdomain.example.com
be affected or not?wp-config.php
.--url
as the "from" domain, is there a need for it to be included as a separate flag in the command?WP_HOME
andWP_SITEURL
are defined in the config with a different domain.The text was updated successfully, but these errors were encountered: