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));

Use Contact Form 7 to collect business leads and enquiries? I created Storage for Contact Form 7 plugin which stores them safely in WordPress database.

Get it now for only $19 →

Leave a Reply