# Site Name, Tagline and URL Shortcodes

> Adds [site_name], [site_tagline] and [site_url] shortcodes so text that mentions your site stays correct if you rename or move it.

- Type: PHP
- Runs: Run everywhere
- Category: [Content](https://wpide.com/library/category/content/)
- Tags: shortcode, site-name, branding
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/site-info-shortcodes/

## Code

```php
add_shortcode( 'site_name', function () {
    return esc_html( get_bloginfo( 'name' ) );
} );

add_shortcode( 'site_tagline', function () {
    return esc_html( get_bloginfo( 'description' ) );
} );

add_shortcode( 'site_url', function ( $atts ) {
    $atts = shortcode_atts( array( 'link' => 'no' ), $atts, 'site_url' );
    $url  = home_url( '/' );

    return 'yes' === $atts['link'] ? '<a href="' . esc_url( $url ) . '">' . esc_html( untrailingslashit( preg_replace( '#^https?://#', '', $url ) ) ) . '</a>' : esc_html( $url );
} );
```

## Notes

[site_url link="yes"] prints a clickable link instead of plain text.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Site Name, Tagline and URL Shortcodes" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
