If you are not physically moving anything, then it’s a matter of 20 seconds with the “better search and replace” plugin, once your host and/or DNS is set to resolve things correctly.
Files would be moved from dev to live directory
I feel that it’s important to point out that, while leejosepho’s code will likely work for many installations, there’s a reasonable chance it will not. As explained in Steve’s link:
If you do a search and replace on your entire database to change the URLs, you can cause issues with data serialization, due to the fact that some themes and widgets store values with the length of your URL marked. When this changes, things break.
leejosepho’s code searches the 3 locations where URLs reliably exist in a default installation, but they are known to occur in other locations when certain plugins or themes are used. He did say “try” his code, implying that it might not work for you. One of the methods listed on the source page after the above quote will reliably work in all cases.
The code I posted will work, and there is very little chance of it causing any trouble since I have already removed a fourth line that could have caused the trouble you have mentioned. The plugin trouble I have occasionally had apart from anything that code can do has been caused by the fact of a given plugin using “absolute server path” and needing to be removed and re-installed to reset it.
@leejosepho – It will not work completely in all instances. We are beyond what the OP cares about though. If you would like to continue discussing, DM me in WordPress Slack – same user name. I can explain further, or you can convince me further 🙂
Thank you all for your replies. Looks like there are a couple of plugins that may do what I want, but both come with some caveats from the developers:
https://ww.wp.xz.cn/plugins/dynamic-hostname/
https://ww.wp.xz.cn/plugins/any-hostname/