Fix WordPress' Jetpack Publicize Not Using Correct URL Structure in Permalink
February 17 2015, 3:35am
Jetpack's Publicize can be a handy feature to automatically share your post to various social network's like facebook, twitter and google plus.
One of the annoying features is when it shares it on those social networks it posts a http://wp.me...
short link. You can fix that by deactivating "WP.me Shortlinks" in Jetpack settings.
Another annoying thing is even if "WP.me Shortlinks" is disabled, it will share the url in the classic http://domain.com/?p=123
permalink structure. In order to fix this, add the following to your theme's functions.php
file:
function tweakjp_cust_shortlink() {
global $post;
if (!$post) {
return;
}
return get_permalink($post->ID);
}
add_filter( 'get_shortlink', 'tweakjp_cust_shortlink' );
This solution was posted by the Publicize plugin author here: https://wordpress.org/support/topic/publicize-full-url-to-twitter