Skip to content

Instantly share code, notes, and snippets.

@zackkatz
Created March 31, 2022 19:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zackkatz/1fd83bb4c43f2fd9f8abf75dbe4d07c6 to your computer and use it in GitHub Desktop.
Save zackkatz/1fd83bb4c43f2fd9f8abf75dbe4d07c6 to your computer and use it in GitHub Desktop.
Adds a shortcode to return the WordPress site's URL
<?php
// Shortcode for Site URL - Use [site_url] for Shortcode
add_action( 'init', function() {
add_shortcode( 'site_url', function( $atts = null, $content = null ) {
return site_url();
} );
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment