Is it possible to keep social share counts when changing permalink structure?

Go To StackoverFlow.com

2

The site's current structure is www.mysite.com/2012/Post-Name but for SEO purposes I would like to change it to www.mysite.com/Post-Name. Easy enough through the WP admin, but here lies the problem. I would like to preserve the social counts for Twitter, Facebook, Google+ and LinkedIn.

My first thought: Create a static version of the current posts (there are only 11 at the moment) which would keep the url the same. The problem with that approach is that those posts are no longer posts so they will not show up in the category archives. It would also involve a lot of time to convert and then hard code into the loop.

Has anyone been able to accomplish this or do you have any suggestions? Any help would be greatly appreciated.

Thanks for your time.

Bart

2012-04-03 22:11
by Bart Hook


1

I just made a post about this very issue. I had the same problem and used the following method to get back my twitter/facebook counts.

http://lutfitorla.com/post/keeping-sharethis-digg-digg-social-counts-after-a-wordpress-permalink-change/

I used the ShareThis wordpress plugin before this. I did a wordpress permalink change, removed the www from my address and also switched over to the diggdigg social plugin. There's quite a few steps so you can check it out there.

Hope this helps you and other people with the same problem.

2012-07-31 13:08
by Lutfi Torla


1

I Believe this will help for any one, I haven't tried but it is worth reading this one.The logic is very simple, read this one.

global $wp_query;
$post = $wp_query->post; //get post content
$id = $post->ID; //get post id
$postlink = get_permalink($id); //get post link
$commentcount = $post->comment_count; //get post comment count
$title = trim($post->post_title); // get post title

//HACK BY JOAO
$sharing_url = get_permalink();

$url_change_id = "1020";
$post_id = $id; 

if ($post_id < $url_change_id) {
$url_id_postfix = "/?p=" . $post_id;

$sharing_url = "http://example.com".$url_id_postfix;
}

$link = explode(DD_DASH,$postlink); //split the link with '#', for comment link
$url = $link[0];

$url = $sharing_url;

So this hopefully fixes it for you guys, any question feel free to ask!. http://joaogarin.com/article/changing-permalinks-wordpress-keeping-social-proof

2014-04-14 14:19
by Sabir Abdul
Thanks, I have updated my answe - Sabir Abdul 2014-04-14 14:52


1

I came up with this method after researching for weeks...

If you want to change permalink structure and keep the Facebook likes for your old posts, the following method seems to be the only feasible way. (301 redirect does not transfer Facebook like box count - http://www.stateofdigital.com/the-problem-social-buttons-301-redirects )

  1. Record all the old posts’ URLs
  2. Install “Custom Permalinks” plugin - https://wordpress.org/plugins/custom-permalinks/
  3. Change permalink structure
  4. Change the old posts’ permalinks (new permalink structure) back to their URLs (old permalink structure) - so your new posts will follow new permalink structure, and old posts will keep their old permalink structure
  5. Get back the Facebook likes!

This will take a lot of time if you have a lot of posts, but it works.

2015-01-16 07:40
by Kay


0

When working with Twitter / Facebook APIs, I've once looked into how they handle the various URL shorteners (e.g. if they attribute the share counts to the original URL). At least back then, they handled those shorteners that were using 301 redirects to indicate the final original URL.

I suggest you do the same - make sure that you have 301 (permanent) redirects from the old URLs to the new ones. (I am quite sure there should be a WP plugin for that). Then, hopefully, both Facebook and Twitter will update their final URL accordingly and you'll have merged score for both URLs.

2012-04-03 22:26
by Aurimas
Definitely worth a try Aurimas. Thanks for the suggestion - Bart Hook 2012-04-03 23:34
Ads