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

How to Get Short Branded Urls with WordPress

Last updated on by
Special WordPress Hosting offer for WPBeginner Readers
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,, or even There are two disadvantages of using these services. First they are not brandable, and second they are not reliable as 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:

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:

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 to be used on’s self-hosted blogs. Currently urls are only reserved for 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 experts 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 »


  1. Mark Cooney says:

    I have my own short url which I bought, is there a plug for me to make a website using my own service?

  2. WPBeginner Staff says:

    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.

  3. Susan Fengler says:

    Frustrated! As a beginner, what and where do you put this code? I can’t stick it ‘anywhere I like’ when I don’t know even where …. Please remember we are BEGINNERS and not familiar with code and where to put them! Susanne

  4. Tanay Talesra says:

    Which one should I use? or this one?

  5. Manveet SIngh says:

    I agree when you say is with only.. but there is something fishy that uses :)

    example check out it was posted from, and the links to a post on by Matt Mullewang :)
    Maybe they are testing something out to make available to blogs or he’s just teasing us :)

  6. Kamal says:

    This is indeed a very cool trick for blogs.

    I personally like and the evergreen tinyurl.

  7. Matt says:

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

  8. kovshenin says:

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

    ~ @kovshenin

  9. Brandon Cox says:

    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!

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.