wordpress snippets last updated   : August 18, 2014
we now have 638 snippets

Blog default short URLS

wordpress snippet

Adding this code snippet to your wordpress theme will display the built in short your for your blog post. You could use something like this for your tweets rather then bit.ly or other URL shorteners.

snippet :  PHPcopy
<?php
          echo get_bloginfo('url')."/?p=".$post->ID;
?>

Did you like this post? If so please share it with your friends. Thanks!

  • Pingback: Tweets that mention Wordpress Blog default short URLS – wpsnipp.com Wordpress code snippets for your blog -- Topsy.com

  • Anonymous

    That does work, but the query variable (?p=) can look a bit unprofessional on some sites. Another alternative is to use a system called YOURLS paired with a short vanity domain. You can get .me addresses for a fairly low price right now … then just set up YOURLS and you have your own, custom url-shortener.

    YOURLS also comes with a handy WordPress plug-in to automatically create short urls whenever you create a post. They’re added to the meta tags on the page and can be automatically sent via Twitter to all your followers. You’ll also get statistics regarding who clicked a short link, where they saw it, and where they’re at. It helps you keep track of who else is using your short urls in the market!

    • Kevin

      Thanks eamann that would work well, I will have to check that out thanks. Other options would be http://bit.ly http://tinyurl.com and others are available.

      • http://mindsharestrategy.com Eric Mann

        The advantage of having your own, though, is complete control over the domain. When using bit.ly, a typo can send your readers to something very different than what you intended. With your own short domain, a typo still sends them to your site, even if it’s a different post or just a “not found, please search” box.

        • Kevin

          Good point very true,

jqsnipp.com | we just launched jquery snippets website