Support » Plugin: Twitter Tools » [Plugin: Twitter Tools] long permalinks kill tweets – short work also tweet box

  • hey i like to have my urls with my domain that way they point back to my site…

    In a previous version pre-oAuth I hacked your plugin to use the Post ID and that worked … I have not started hacking at your plugin again because I just installed it.

    Tweeting short Post Names works ie
    But when i use a real permalink the tweet crashNburns probably because its over 140 char

    I can also tweet from the direct tweet box from the Posts menu so i know my connection is good

    I really dont like using url shorteners because it cuts down on back links which are very important for google rank even if they are postID urls.. better then using someone else’s domain.


    maybe i will hack on it later today or tonight and then release a plugin for your plugin but it really should be a basic option to use PostID when the Permalink is too long…

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Contributor Alex King


    You can write a plugin for Twitter Tools to do this (see the included examples), no need to hack it each time.

    hey npsites, did you wind up creating that plug-in you mentioned?

    i had the exact same problem where my posts weren’t being sent to twitter because of the permalink being too long and the 140 char limit on twit.

    i created a post called “test”, which made the url look like, published it, and it got sent to twitter just fine via twitter tools.

    also, like you, i’d rather use my domain name and post id vs. links.

    let me know if you wound up creating something to work with twitter tools.

    well I tried to apply a filter but I have not had success yet

    If you need a fix edit line 489 in TwitterTools to be

    //		$url = apply_filters('tweet_blog_post_url', get_permalink($post_id));
    		$url = apply_filters('tweet_blog_post_url', get_settings('home') .'/?p='. $post_id);

    I am going to try to figure out why $post_id does not get picked up when I put it in the functions.php file

    probably a global thing

    function ttpidurl($url) {
    $url = get_settings('home') .'/?p='. $post_id;
    return $url;
    add_filter('tweet_blog_post_url', 'ttpidurl');

    Try global $post; $post_id = $post->ID;. Also, make the top line function ttpidurl() { because you are not using the $url parameter.

    thanks npsites & richardx!

    npsites, if you get the functions.php to work with the suggestion from richardx, would you mind posting the final code here so i can try it out and we can share with everyone else who is likely having the same problem with twitter tools. i was reading through their forums and seems like lots of people have the problem, but no one posted any resolution and the plug-in developer hasn’t responded recently either.




    So does this mean there’s a known bug with the plugin? All my posts are tweeted fine, except for ones with long URLs. Tried it with the plugin and without, but the URLs aren’t being shortened, therefore the post isn’t tweeted.



    i haven’t applied the fix recommended above, but i’m manually sending tweets to twitter using the same method (using the postid instead). plug-in seems to work for short urls. my assumption is that it has to do with tweet length restrictions. if the text + url combined is longer than what twitter accepts, twitter tools won’t be able to send the tweet.

    i’m not sure what happened along the way, but twitter tools used to shorten the url before posting to twitter. can’t seem to figure out why that stopped working after the upgrade.

    Thanks Guys!

    I added this to my functions.php file

    function ttpidurl() {
    global $post; $post_id = $post->ID;
    $url = get_settings('home') .'/?p='. $post_id;
    return $url;
    add_filter('tweet_blog_post_url', 'ttpidurl');

    And modified the twitter-tools.php file on line 489 as suggested above, and it has worked fine.

    Don’t suppose anyone could help me figure out what they did here?

    I’d like for Twitter Tools to tweet either A) domain.ext/p=## link, or B) a link pointing to the p=## permalink.

    The functions.php addition is for the theme’s functions.php? I figured TT worked all on the backend and wouldn’t pick up anything there…

    and when buffalo made the change on the plugin’s line 489, was it NPSites’ change? or richard’s below it? ’cause I’m not quite sure what richard suggested we change…

    $url = apply_filters('tweet_blog_post_url', get_settings('home') .'/?p='. $post_id);

    to this?

    $url = global $post; $post_id = $post->ID;

    (gonna try a few of these myself but…if someone can clear it up ab it for me, man you’d be awesome.)

    Edit: Figgered out how to make it spit out domain.ext/p=## tweets. Working on making it bit.lyfy that link as well — I think it’s as simple as putting the same fix on the plugin. >.>;

    and then I broke it…accidentally hit shift-page down instead of shift-end and deleted, and when I clicked ‘refresh’ to undo the changes, I think it saved the changes for me…

    of course, now I keep getting and error message. Using this code:

    // $url = apply_filters('tweet_blog_post_url', get_permalink($post_id));
                       $url = apply_filters('tweet_blog_post_url', global $post; $post_id = $post->ID;);

    nets this error:

    Parse error: syntax error, unexpected T_GLOBAL in (domain-level-folder-stuff-that-has-a-username)/html/erfblog/wp-content/plugins/twitter-tools/twitter-tools.php on line 490

    So, naturally…I forgot what I even did. head => desk. =\

    It sounds like you made a syntax error or declared a global in the wrong place. Check your code carefully!

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘[Plugin: Twitter Tools] long permalinks kill tweets – short work also tweet box’ is closed to new replies.