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 use custom fields named 'url' to add another website url (like http://www.youtube.com), I want to rewrite the 'url' as http://www.mysite.com/go/123.

I tried all rewrite plugins, no one could do this.

Can I set post id as 123? Or can I set a random number as it?

share|improve this question
Are you trying to proxy Youtube via a URL on your site? – Brian Fegter Oct 16 '12 at 16:56
Do you mean redirect to external site? Rewrite is usually for manipulating URLs to resources on your site. – Rarst Oct 16 '12 at 18:12
I add more info. – user22541 Oct 17 '12 at 3:59

Take a look at this tutorial (Build a Short URL Service with WordPress Custom Post Types) that show how to create this kind of redirection

or you can use a plugin that does that for you GoTo Redirect

share|improve this answer
Thanks for your reply, I didn't say clearly, just add more info. – user22541 Oct 17 '12 at 3:58

Thanks for your reply, I want to auto rewrite link when I add it in custom fields named "url".

For example:

I named a "url" in custom fields add www.yahoo.com as value, I use <?php echo get_post_meta($post->ID, 'url', true); ?> to get it, I don't want to show the link www.yahoo.com, I want to rewrite it as www.mysite.com/29382 with random number automatically generated.

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.