• Resolved brandimor

    (@brandimor)


    Is there a shortcode or a way to create a shortcode to get the current Site URL?
    I need it for when I develop and move from one site to another and have not found a good way yet and this seems like it might do the trick

Viewing 1 replies (of 1 total)
  • Plugin Author Vova

    (@gn_themes)

    Hi @brandimor,

    there is no such shortcode, but you can easily create it yourself.

    Add the following snippet to the end of the functions.php file of your active theme or into a site-specific plugin:

    add_action( 'init', function() {
    
    	add_shortcode( 'site_url', function( $atts = null, $content = null ) {
    		return site_url();
    	} );
    
    } );

    Then just use the following shortcode: [site_url]

    Do not use this code on PHP version 5.2 or lower.

    • This reply was modified 6 years ago by Vova. Reason: Note on PHP version
Viewing 1 replies (of 1 total)
  • The topic ‘Get Site URL Shortcode’ is closed to new replies.