How to Add Shortlink Support to Twitter Tools

By default the Twitter Tools plugin uses URLs such as in your tweets. However, if you are using one of the URL shortener plugins (that make use of the standard get_shortlink() function), chances are that you would rather include the URL generated by that plugin. To do that, simply add this to your theme’s functions.php:

add_filter('tweet_blog_post_url', 'get_shortlink_for_twitter');
function get_shortlink_for_twitter($url) {
	return wp_get_shortlink(url_to_postid($url));

Leave a Reply