I use the Twitter Tools plugin for WordPress to send my new posts to Twitter and to post my tweets on my blog. Sending your posts to Twitter is a great way to build traffic.
On the first of April, I and others had a problem with the tweets about our blog post not getting shortened URLs. Someone on Twitter actually noticed and sent me a tweet about it. I don’t know what changed, but something did.
I never figured out why it stopped working, but I did figure out how to fix it. I am posting that info here so others can use it. It requires making some php file changes. I am not a php guru so making changes to the php files is always done with care (i.e. backup the file before you change it).
Here is what I did to make it work:
I added the following to the function.php for the template:
1. I added the line below after the first line <?php in function.php
add_filter(‘tweet_blog_post_url’, ‘makeShortURL’);
2. I added the function code below before the first function definition in the file.
function makeShortURL($URLToConvert) {
$shortURL= file_get_contents(“http://tinyurl.com/api-create.php?url=” . $URLToConvert);
return $shortURL;
}
This worked for me. My tweets now show up with a shortend URL using tinyurl.com. I hope it works for you.
Related posts:



Hey Dave,
I tried your example. It didn’t seem to work, I copied and pasted it like you said… it said I had a parse error on line 4, which is this line…
$shortURL= file_get_contents(”http://tinyurl.com/api-create.php?url=” . $URLToConvert);
any suggestions?
Here is the code copied from my function.php file.
function makeShortURL($URLToConvert) {
$shortURL= file_get_contents(“http://tinyurl.com/api-create.php?url=” . $URLToConvert);
return $shortURL;
}
I don’t see anything wrong with the line you showed. All I can think is to review the code around it.
David