WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a hosted Wordpress blog running on my own domain. I've recently considered trying to build a custom URL shortener (a la bit.ly) that I manage and control using a very short domain. I'm wondering how I can achieve this.

For example:

I want this: http://nerdgap.com/some-made-up-post-here/

To shorten to this: http://g4p.it/23 (where 23 is the Worpress post ID).

Is this possible? How can I go about it?


share|improve this question

Try Yourls. I hadn't used it myself but feedback I seen is very positive and it is project by very known developers (Lester Chan and Ozh).

share|improve this answer

You already get shortlinks of the form ?p=post_id, so http://nerdgap.com/?p=66 points to http://nerdgap.com/great-big-update-plus-giveaway/. You could exploit this by creating a simple redirection from http://g4p.it/{$post_id} to http://nerdgap.com/?p={$post_id}.

You can then integrate this in your editor (the "Get Shortlink" button) and add a <link rel="shortlink"> in your header by hooking into the pre_get_shortlink filter, and returning http://g4p.it/{$post_id}.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.