Beginner's Guide for WordPress - Start your WordPress Blog in minutes.
Choosing the Best
WordPress Hosting
How to Easily
Install WordPress
Recommended
WordPress Plugins
View all Guides

How to Get Short Branded Urls with WordPress

Last updated on by
Follow WPBeginner on YouTube
How to Get Short Branded Urls with WordPress

With social media marketing on its peak, and URL shortening service at it’s highest demand, bloggers are turning to services like tr.im, bit.ly, or even ekey.us. There are two disadvantages of using these services. First they are not brandable, and second they are not reliable as tr.im said they will be closing down. Much thanks to a powerful script like WordPress, we can now use it to create short URLs and have our brand in it.

*Note: You cannot use this tutorial if your domain is too long.

This hack is very simple. All we are doing is instead of displaying our normal SEO Friendly URLs, we are displaying the original Post-ID URL which WordPress generates anyway with each post created.

All you have to do is copy and paste the following code in your single.php wherever you like.

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

and it will display a URL of this sort:

http://wpbeginner.com/?p=734

Now for those of you who do not know how you will be using this code, stay updated as we will be showing you how to use this for different social media sites in our next tutorial.

This hack is not changing your SEO Friendly URLs, when someone types this URL in the box, or clicks on this URL, the URL they will actually see is your long permalink that you made using our SEO Friendly URLs tutorial.

This hack only lets you shorten your page and post URLs, but if you want to shorten an external URL using your WordPress, you can also do so by using a plugin called Short URL Plugin.

This plugin lets you create a short URL like:

http://wpbeginner.com/u/23

It also lets you track how many clicks each URL has received, so it is also a great analyzing tool. But once again this will only work if you have a short domain.

These features are handy and a good substitution until ofcourse Matt Mullewang and Automattic release the plugin for WP.me to be used on WordPress.org’s self-hosted blogs. Currently WP.me urls are only reserved for WordPress.com users as announced by Matt on WordPress Blog.

Remember to stay updated for our next tutorial in which we will show you how you can add share this links to popular social media sties.


Editorial Staff at WPBeginner is a team of WordPress lovers led by Syed Balkhi. Page maintained by Syed Balkhi.

WPBeginner's Video Icon
Our HD-Quality tutorial videos for WordPress Beginners will teach you how to use WordPress to create and manage your own website in about an hour. Get started now »
  • http://www.wpbeginner.com/ WPBeginner Staff

    The code goes in your theme’s single.php file. You can edit this file by clicking on Appearance > Editor and then select single.php from the list of files on your right hand.

    However, we understand this method can be difficult for some absolute beginners. That is why we have also mentioned a plugin in the article. Hope this helps.

  • Tanay Talesra

    Which one should I use? Bit.ly or this one?

  • http://ManveetSingh.wordpress.com Manveet SIngh

    I agree when you say wp.me is with wordpress.com only.. but there is something fishy that ma.tt uses :)

    example check out http://twitter.com/photomatt/status/23602100403441664 it was posted from ma.tt, and the wp.me links to a post on ma.tt by Matt Mullewang :)
    Maybe they are testing something out to make wp.me available to wordpress.org blogs or he’s just teasing us :)

  • http://npxp.com Kamal

    This is indeed a very cool trick for blogs.

    I personally like bit.ly and the evergreen tinyurl.

  • http://wpswitch.com Matt

    This is super useful. I am currently using the tinyurl API.

  • http://kovshenin.com kovshenin

    Hey you might also try an alternative called Twitter Friendly Links. It’s available at the WordPress Plugin directory. The plugin page is here: http://kovshenin.com/712 (make sure you watch the video)

    ~ @kovshenin

  • http://www.egracecreative.com Brandon Cox

    Thanks for the great tip. I had learned this trick a couple of months ago and had forgotten to do anything with it. Great plugin you plugged too!