Title: Get Site URL Shortcode
Last modified: November 6, 2018

---

# Get Site URL Shortcode

 *  Resolved [brandimor](https://wordpress.org/support/users/brandimor/)
 * (@brandimor)
 * [7 years, 7 months ago](https://wordpress.org/support/topic/get-site-url-shortcode/)
 * 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](https://wordpress.org/support/users/gn_themes/)
 * (@gn_themes)
 * [7 years, 7 months ago](https://wordpress.org/support/topic/get-site-url-shortcode/#post-10857277)
 * Hi [@brandimor](https://wordpress.org/support/users/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 7 years, 7 months ago by [Vova](https://wordpress.org/support/users/gn_themes/).
      Reason: Note on PHP version

Viewing 1 replies (of 1 total)

The topic ‘Get Site URL Shortcode’ is closed to new replies.

 * ![](https://ps.w.org/shortcodes-ultimate/assets/icon-256x256.gif?rev=2547563)
 * [Shortcodes Ultimate - Content Elements](https://wordpress.org/plugins/shortcodes-ultimate/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/shortcodes-ultimate/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/shortcodes-ultimate/)
 * [Active Topics](https://wordpress.org/support/plugin/shortcodes-ultimate/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/shortcodes-ultimate/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/shortcodes-ultimate/reviews/)

## Tags

 * [shortcode](https://wordpress.org/support/topic-tag/shortcode/)
 * [site url](https://wordpress.org/support/topic-tag/site-url/)

 * 1 reply
 * 2 participants
 * Last reply from: [Vova](https://wordpress.org/support/users/gn_themes/)
 * Last activity: [7 years, 7 months ago](https://wordpress.org/support/topic/get-site-url-shortcode/#post-10857277)
 * Status: resolved