So why do I need this? This wordpress site url shortcode is perfect for a staging environment, although in most cases I use Better Search Replace plugin after moving the site to the live environment.
This is also great on client sites, they can change the domain of their website without learning MySQL, PHP, etc.
Add this to your functions.php
add_action( 'init', function() {
add_shortcode( 'site_url', function( $atts = null, $content = null ) {
return site_url();
} );
} );
To use, add this shortcode to the editor
[site_url]