Support » Plugin: Latest Tweets Widget » Any way to 'nofollow' links in tweets?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author timwhitlock


    There are some filters available, see the Other Notes tab

    I think you’ll have to render the whole tweet yourself using latest_tweets_render_text, or do some string manipulation on the rendered html afterwards with latest_tweets_render_tweet

    Thanks Tim, here’s a simple replacement for anyone also searching that adds rel=nofollow after using the ‘latest_tweets_render_text’ filter:

    $tweet = latest_tweets_render_html('twitusername', 1);
    $newtweet = preg_replace("/href/", 'rel="nofollow" href', $tweet);

    Obviously this doesn’t check whether a rel=nofollow already exists, however I presume when the tweet is delivered from Twitter it isn’t nofollowed anyway.

    Can you please share the whole code to make the links in there nofollow?

    Tried different approaches, but failed.

    Nevermind, got it working:

    function nofollow_tweets($tweet) {
    	return preg_replace("/href/", 'rel="nofollow" href', $tweet);
    add_filter('latest_tweets_render_tweet', 'nofollow_tweets', 10, 1);
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Any way to 'nofollow' links in tweets?’ is closed to new replies.