URL & Path Shortcodes WordPress Plugin

Published 28th September 2012

I wonder how many of you have been in the same situation as me where you are building a site on your local machine and you add some content in the WordPress post editor, then you go to add some links and realise “wait these URL’s are going to be wrong when I move to a live site”. So you have to remember to change them when you migrate to a live site, or even just a different URL.

That’s why I created the URL & Path Shortcodes WordPress Plugin. Now when you are adding links in your post editor you can set the URL to:

[Some Page]([home_url path=)

Then when you import this content to your new site, as long as you have the plugin installed, the URL will remain correct.

This plugin provides shortcodes for most of WordPress’ directory functions including:

  • [home_url]
  • [site_url]
  • [admin_url]
  • [network_home_url]
  • [network_site_url]
  • [network_admin_url]
  • [content_url]
  • [plugins_url]
  • [wp_upload_dir]
  • [get_template_directory_uri]
  • [get_stylesheet_directory_uri]
  • [get_stylesheet_uri]
  • [get_theme_root_uri]
  • [get_stylesheet_directory]
  • [get_theme_root]
  • [get_theme_roots]

You can even pass in parameters that are available to the corresponding WordPress functions. For example:

[home_url path="faq" scheme="https"]

Check out the URL & Path Shortcodes WordPress Plugin →