Sign up ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

What is the variable that holds the url? / What is the webservice / call that provides me the url? / What is the workaround to read that rel tag from the dynamic generator header (on a self hosted domain).

... to show it beneath each post.

share|improve this question

2 Answers 2

up vote 2 down vote accepted

WP 3.0 includes:


which returns the ?p=1 style url for any post within your domain. This can be filtered, however for other shortening services, which is what the Stats plugin does for self-hosted blogs. With that plugin installed and activated, shortlinks will be output instead of the default, and can be retrieved with the function which can be used within the loop as:

echo wp_get_shortlink()

or to retrieve any post outside the loop:

$link = wp_get_shortlink($post->ID);
share|improve this answer
I was not aware of the fact that the stats plugin offers shortlinks. –  hakre Nov 9 '10 at 23:32
it's not exactly well-documented - I noticed it by accident ;-) –  somatic Nov 9 '10 at 23:50 shortlinks are a feature of The were introduced in this article: — shorten your links.

On a webblog you can make use of that feature. The button which reveals the shortlink gets it from the page source, the link is stored there within a hidden input element.

So I'm unaware how this should be possible to use on other sites then, sorry.

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.