Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have a client site that uses seo friendly URL's (/postname/)

Up until yesterday they were using the default permalink structure of ?p=1234

They've had it set like that for years and have had their posts shared on facebook, twitter, and other networks. The problem with changing the permalinks now is that the social media sharing badges on their site have all reset their counts to 0 because the actual URL has changed. I read that Twitter would eventually begin updating itself due to it's use of checking redirected URL's but that is not the case for facebook.

I would like to edit the code for the sharing buttons to pull in the original permalink instead of the new one. Is that possible?

ie.

$plink = get_permalink($post->ID);
$eplink = urlencode($plink);

What can I use in it's place to pull in the original p=1234 instead of the seo friendly name?

Thanks.

share|improve this question

1 Answer 1

up vote 2 down vote accepted

Use one of the_shortlink (complete link) or wp_get_shortlink() (bare link) both introduced in WordPress 3.0.0.

share|improve this answer
    
Thank you. exactly what I was looking for. –  gteh Feb 8 '13 at 15:54

Your Answer

 
discard

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.