• Resolved kimonoko

    (@kimonoko)


    I have found several links online on how to preserve share counts after changing permalink structure with other sharing plugins (see here and here), but nothing for Jetpack and Sharedaddy.

    Is there some PHP code or trick I can use to tell Jetpack/Sharedaddy to count the old URLs in its total share count? I’m sure it can be done; I’m just not much of a coder.

    My website can be found here. Thank you so much for the help!

    https://wordpress.org/plugins/jetpack/

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic 🚀

    You can use the sharing_permalink filter to customize the links used by Jetpack’s Sharing module.

    Here is an example of a small plugin that uses the filter to change full permalinks into shortlinks instead, for example:
    https://wordpress.org/plugins/jetpack-shortlinks-for-sharing-buttons/

    Thread Starter kimonoko

    (@kimonoko)

    Thanks for the reply, Jeremy! It seems like this solution only works to prevent loss of social counts in the future? It doesn’t work retroactively to restore older links, in other words.

    Also, some sites (Reddit most especially) won’t take shortlink submissions of any kind, so this solution is also limited in that regard.

    Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic 🚀

    It will work for all your posts, past and future. You can use the filter to build your own plugin and force all sharing buttons to use the old permalink structure, and thus the old sharing counts.

    Thread Starter kimonoko

    (@kimonoko)

    Thanks! It turns out I had that plugin installed already. Now that it’s activated, how can I create a filter to affect old and new posts?

    Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic 🚀

    By default, the plugin changes sharing count URLs for all posts, old and new. You don’t have to configure anything.

    However, if you want to keep your old sharing count URLs, that plugin won’t help: you’ll need to develop your own plugin, and can use the Shortlink plugin as a start. You’ll only need to change the contents of the jp_sd_custshortlink() function to match your old permalink structure:
    http://plugins.svn.wordpress.org/jetpack-shortlinks-for-sharing-buttons/tags/1.0/jp-sd-custshortlink.php

    Thread Starter kimonoko

    (@kimonoko)

    That’s great! Thanks, Jeremy. So I just add in my old permalink structure, like so?

    function jp_sd_custshortlink_enable(http://moviefail.com/2014/10/01/sample-post/)

    I guess I’m not sure what to do from there. I’m definitely a PHP novice!

    Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic 🚀

    That’s actually a bit more complicated than that, since you’ll need to build your old permalink structure and return it inside the jp_sd_custshortlink() function.

    If your old permalink structure used dates and the post name, you’ll need to query for this data and build the URL from there.

    If you do not feel comfortable editing PHP files and building your own plugin, I’d recommend that you either move back to your old permalink structure if social counts are important to you, or leave the social counts as they are today.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Changed permalink structure, but Jetpack/Sharedaddy didn't preserve social count’ is closed to new replies.