Is there a way to force a social sharing plugin to use the shortlink each of my WP posts automatically gets (YOURLS service in my case) to pass to the social service the visitor clicked, instead of permalink?

If not, it has to be built with that functionality? (not that I have found any that does that)

  • 1
    Maybe, depends on the plugin. What plugin are you using?
    – s_ha_dum
    Jun 3, 2013 at 16:18
  • @s_ha_dum, right now Shareaholic. I was hoping to find a way to trick plugins universally to use shortlink by default, so I won't have to make changes inside the plugin code (in case they release a new plugin update), but I am open to any alternatives, including altering plugin's code.
    – Saxtus
    Jun 3, 2013 at 21:11
  • Do you have your own YOURLS installation? If so use: wordpress.org/plugins/yourls-link-creator to replace the default wordpress shortlink. Afterwards you can use the_shortlink or get_the_shortlink instead of the permalink, if shareaholic supports that, which would make sense. Maybe there is a plugin todo so with the yourls.org service, but if, then I don't know it. Jun 3, 2013 at 22:28
  • @ngsonst, Yes, I have my own YOURLS installation, but unfortunately after contacting with Shareaholic support, they told me that shortlinking is happening at Shareaholic servers for the moment, but they plan to build support for local shortlinks in the future.
    – Saxtus
    Jun 4, 2013 at 12:24

2 Answers 2


I very much doubt you can universally "trick" all plugins without touching at least some of some plugin code, but I think your best bet would be filters on the_permalink and post_link, and maybe pre_post_link. Even if you got that working it would be pretty "heavy". That is, a lot of processing happens before you get to interrupt things.

  • You are right. The plugin must be built in a way that can be interrupted by filters, due to the fact that permalink is still needed for "likes" counters, complicating things more...
    – Saxtus
    Jun 4, 2013 at 12:41

I've found a working solution around JetPack, that I can be inspired from it, for future reference.

Seems that this plugin does exactly what I want: Intercepts sharing buttons to use post's shortlink by adding a filter for (JetPack's in this case) sharing_permalink

Permalink should not bypassed completely, as it's used for "likes" counters, matter is more complicated than I thought, but it's a start and so far is working. I was trying to avoid JetPack, but it will do for now.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.