WordPress Ugly Permalink as Short URL for Twitter-ing

Twitter & WordPressMartin Wright made a good point in his guest post on TwiTip about using our own blog domain to host short URLs pointing to your blog posts, instead of services like TinyURL, Bit.ly and tr.im.

Martin suggested the use of Short URL WordPress Plugin to do the job, but I see a better way to do it.

Back to the basic, what was the permalink structure when you first installed WordPress? The ugly permalink structure that looks like this:

http://www.sheeptech.com/?p=123 (123 is the Post-ID)

Most WordPress users would change their permalink structure to a more SEO friendly ones, instead of keeping the ugly permalink structure above.

However, an ugly permalink will not stop working even after the permalink structure is changed. Instead, it will automatically redirect you to the actual blog post with the correct permalink. For example:

http://www.sheeptech.com/?p=881 will redirect to http://www.sheeptech.com/youtube-mutes-video-with-copyrighted-songs

Say I would like to share my blog post on YouTube Muting Videos on Twitter, I’d post it as (http://www.sheeptech.com/?p=881), instead of the full permalink of it or a third party short URL like http://tr.im/8y5j.

How to identify Post-ID?
The ugly permalink structure looks like this: http://www.sheeptech.com/?p=[Post-ID]. You first have to identify the Post-ID of your blog post, before you can use the ugly permalink as a short URL.

To identify the Post-ID of your blog post, just look at the address bar when you are editing or writing a post. The Post-ID would be the number next to “post=“.

Post-ID on address bar

The benefits:

  • No extra work. The ugly permalink is generated automatically everytime you publish a blog post. No need of a plugin at all.
  • The URL will not be broken. Even when you change your permalink struture again, the ugly permalink will still point to the same blog post. If you’re using a plugin to shorten URLs, they might be broken if the plugin went wrong, but the ugly permalink will almost never be broken.
  • You can call up the Post ID within your blog template using the <?php the_ID(); ?> tag.

As there is no extra work for this method, I can conveniently add a Twitter button onto all my blog post. This is the line I inserted to single.php:

<a rel="nofollow" href="http://twitter.com/home?status=Reading: (<?php the_title(); ?>) at http://sheeptech.com/?p=<?php the_ID(); ?>"><img src="http://www.sheeptech.com/wp-content/uploads/2009/01/twiter_01-w32-h32.png" alt="Tweet This" /></a>

Click on the blue bird at the end of this post for a demo.



  1. Wesley - January 21, 2009 @ 2:43 am

    Good thinking, but I don’t like the concept. http://is.gd/abc is much shorter than http://sheeptech.com/?p=135 (with twitter every extra character counts)

    • Vincent - January 21, 2009 @ 12:18 pm

      It depends, if you are want to save more on URL so that you can talk more, this is not a good option—unless you have a very short URL for your blog too.

      The good is people know exactly where the URL will be bringing them, and your blog brand gets some exposure even if they don’t click on it.

  2. Marc - February 14, 2009 @ 4:01 am

    This would be cool if there was a plugin to auto tweet, ala twitter tools, that used the “ugly links” instead of tweeting the SEO friendly post url. It should also pull the www. from the beginning, thats 4 characters. Should look something like http://yourdomain.com/?p=135

    • Vincent - February 14, 2009 @ 2:45 pm

      You mean tools like twitterfeed? If yes, I personally thinks that it is more personal to tweet your blog post yourself, instead of using a bot.

      Wouldn’t be a heavy task, unless you blog very frequent, say tens in a day.

      • Marc - February 20, 2009 @ 8:32 pm

        Yes, it needs to get posted immediately from frequent daily posts for one particular site of mine. Timing is sometimes critical and Twitter makes the notification lightning fast, in most cases.

  3. Rich Schmidt - April 3, 2009 @ 10:43 pm

    Thanks for the idea! I was planning to use that short url plugin you mentioned, but I was wondering how to go about making it automatic for users to tweet it… and your solution looks perfect!

    My reason for doing it is what Vincent already mentioned in his earlier comment: even if they don’t click on it, your domain is in front of them. Excellent!

  4. kauai - April 15, 2009 @ 11:29 am

    The mac has a great multiple clipboard tool called CopyPaste Pro that has a link shortener built in so you just highlight click a button and you have the short URL in the clipboard to paste anywhere.

    Also it is just as essential as the clipboard itself. Seriously useful.

  5. Brad - August 10, 2009 @ 2:31 am

    One question though… with regards to TweetMeme…does it also track those ugly URLs or does the Tweetmeme assigned URL (e.g. bit.ly/sample) have to be tweeted for it to be checked?

  6. crayoncrisis - December 7, 2009 @ 6:45 pm

    Great idea. But it looks like Twitter now changed the way it displays hyperlinks and cuts it off before the question mark.

  7. Damien Riley - July 10, 2010 @ 1:37 am

    This absolutely worked for me. I’ll keep an eye on it and see if crayoncrisis’ issue is still valid. Thanks! I wanted a homemade Twitter button and the long permalinks were causing an issue for me. View the end product here: http://twitter.com/rileycentral/status/18135259893

  8. Vincent - July 10, 2010 @ 2:39 pm

    @crayoncrisis: I’m unaware of that. Damien’s sample tweet looks fine to me.

  9. r00m - August 2, 2010 @ 4:15 am

    Thanks for the great tip!

  10. Maichel - March 23, 2011 @ 3:26 am

    how can i make like this website by using shortlink methode and adsense sharing methode ?!


  11. criminal lawyer toronto - April 21, 2012 @ 12:51 pm

    WordPress users may install and switch between themes. Themes allow users to change the look and functionality of a WordPress website or installation without altering the informational content. Thanks.

  12. reverse cell phone lookup - April 25, 2012 @ 3:28 pm

    Widgets are small modules that offer users drag and drop sidebar content placement and implementation of many plugins’ extended abilities. Widgets offer WordPress developers to add functionality to their site. Thanks.

  13. Local SEO Services - May 9, 2012 @ 8:41 pm

    The phrase that is tagged at a greater rate than other tags is said to be a trending topic. Trending topics become popular either through a concerted effort by users or because of an event that prompts people to talk about one specific topic. These topics help Twitter and their users to understand what is happening in the world. Thanks.

  14. jaffa - June 9, 2012 @ 8:43 pm


  15. soccer game - July 22, 2015 @ 6:01 am

    It’s enormous that you are getting ideas from
    this paragraph as well as from our discussion made at this place.

  16. steam games - September 18, 2015 @ 4:40 pm

    Hurrah! Finally I got a web site from where I be able to actually obtain helpful facts regarding
    my study and knowledge.

  17. social media technologies - September 19, 2015 @ 9:04 am

    Think of it аs a gigantic news feed that points trqffic multiple dieectiοns baaed on impressions, conversions, and the likе.
    In early 1923, Ford’s Model T controlled 57% of the domestiϲ
    automobile market. PhilaԀelphia, PA and ԝas cο-hosted by
    thee Social Entrepreneurs of Greater Philadelphia.

  18. dofus kamas - September 21, 2015 @ 8:07 am

    Nice post. I used to be checking continuously this blog
    and I am inspired! Extremely helpful information particularly the closing section 🙂 I care for such info a lot.

    I was seeking this particular information for a very lengthy time.
    Thank you and good luck.

  19. health care - September 25, 2015 @ 2:04 am

    Hi there great blog! Does running a blog similar to this take a
    great deal of work? I’ve no knowledge of coding but I had been hoping to start
    my own blog soon. Anyhow, if you have any suggestions or tips for
    new blog owners please share. I know this is off subject nevertheless I simply wanted to ask.


  20. streaming complet - October 12, 2015 @ 12:09 pm

    It’s the best time to make some plans for the long run and
    it’s time to be happy. I’ve read this put up and if I may just
    I want to recommend you few attention-grabbing issues or suggestions.
    Perhaps you can write next articles relating
    to this article. I wish to learn even more issues about it!

  21. android application - October 14, 2015 @ 12:30 am

    Hello, this weekend is pleasant for me, since this point in time
    i am reading this fantastic educational piece of writing
    here at my home.

  22. مراحل ترخیص کالا - December 16, 2020 @ 11:02 am

    موضوع کلام ی این پیغام از نظر عدیده از افراد مفت و کامل نیست ولی فداکار از محتویات سایت ها و بلاگ ها پیرامون این
    مطلب در وب وجود دارند که می توان از آنها استفاده بهتری داشت

  23. قیمت تیرآهن - February 21, 2021 @ 5:31 am

    موضوع کلام ی این پیام از نظر کثرت از افراد کم ارزش و کامل نیست
    ولی ازجان گذشته از مطالب
    کارگاه ساختمانی ها و بلاگ ها پیرامون این مطلب در وب
    وجود دارند که می توان از
    آنها استفاده بهتری داشت

Leave a Reply

Your email address will not be published / Required fields are marked *