Notes: WordPress Tip #2 – Site URL Shortcode

January 2, 2020

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]
Get In Touch

Email: [email protected]


CAPTCHA image

This helps us prevent spam, thank you.



Categories