WordPress.org

Support

Support » Plugins and Hacks » Picture links not being removed

Picture links not being removed

Viewing 7 replies - 1 through 7 (of 7 total)
  • 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.

    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,
    to
    '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):

    add_filter('aktt_tweet_create_blog_post_data',aktt_remove_tco);
    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.

    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?

    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.

    Plugin Contributor Alex King

    @alexkingorg

    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.

    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!

    Neil

    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.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Picture links not being removed’ is closed to new replies.