Social sharing post's shortlink instead of permalink

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)

Solutions Collecting From Web of "Social sharing post's shortlink instead of permalink"

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.

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

  • Discussion about it: Support for sharing_permalink filter
  • Plugin implementing it: Jetpack shortlinks for
    sharing buttons

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.