Twitter Tools
Picture links not being removed (8 posts)

  1. nris
    Posted 2 years ago #

    I notice that when Tweets have a picture link, the picture is correctly uploaded to the WP website, but the link text remains in the post (and as plain text, not as a link).
    Is there a way to remove it?


  2. zltonline
    Posted 2 years ago #

    I have the same issue. Is there a way to stop the URL from appearing?

    Other than that I am very happy with the plugin.

  3. nris
    Posted 2 years ago #

    It's a shame that Alex King doesn't appear to monitor this forum any more.

    In the end, I found a solution...

    You can either modify the Plugin as follows:

    In /wordpress/wp-content/themes/twitter-tools/classes/aktt_tweet.php
    Change Line 582 from:
    'post_content' => $post_content,
    'post_content' => preg_replace("#http:\/\/t.co\/\S*#","",$post_content),

    Or you can modify the Theme:
    In your theme's functions.php file add the following at the end of the file (before the final "?>" line):

    function aktt_remove_tco($data) {
    $data['post_content'] = preg_replace("#http:\/\/t.co\/\S*#","",$data['post_content']);
    return $data;

    The very best solution is to put the code in a Child Theme - that way if you update the parent theme, you won't lose your change.

    BTW, you might also think about another change to twitter-tools.php: replace each occurrence of "wp_sideload_images" with "media_sideload_images", which has superceded it.

  4. zltonline
    Posted 2 years ago #

    nris - many thanks. Altered akkt_tweet.php abd all works.

    Quick question - only using Twitter Tools to create posts from Tweets so do I need to change wp_sideload_images?

  5. nris
    Posted 2 years ago #

    You don't have to change it - the code uses an older, (presumably less efficient) way of adding Images if wp_sideload_image doesn't exist.

    There's a chance that at some point that this older method might become deprecated, so a future WordPress release might break it, if this plugin hasn't been updated by then.

  6. Alex King
    Plugin Contributor

    Posted 2 years ago #

    It's a shame that Alex King doesn't appear to monitor this forum any more.

    So many incorrect assumptions, so little time.

    I may not have fully understood your regex, but I'm not sure that removing all t.co links is a good idea.

  7. nris
    Posted 2 years ago #

    Hi Alex,

    No offence intended - but when there's been no response from you after 2 months, (and in fact only one response to ANY question on the Twitter Tools support page in that time), I think it's reasonable to make the ONE assumption that you're not monitoring the forum.

    I agree that my solution is not the best way to remove the Picture URLs - it will effectively remove any URL in the Tweet. But I'm pretty much a PHP newbie, and so can't fathom exactly where the plugin decides whether there's an image to add, and what it's URL is - if I could track that down, then I could remove that specific URL from the Tweet, rather than any t.co link.

    I had a deadline to meet for a client, and so I needed something that would work for the kind of Tweets the Client makes.

    For now, my solution works - I look forward to an update with a better solution, for what is an otherwise excellent plugin!


  8. zltonline
    Posted 2 years ago #

    Alex - awesome app as it does exactly what I wanted - that is it makes a post based on a tweet and shows the picture if one is included. I don't need any URLs in the post as no-one needs to click through to the original tweet, so Neil's solution works for me.

    Thanks to the both of you.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Twitter Tools
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic


No tags yet.