Is there a way to make all links no follow in Word Press?

Discussion in 'WordPress' started by kentuckyslone, Mar 19, 2008.

  1. #1
    This may seem like an odd request, but I need to have all links within posts to be no follow - How can that be accomplished?

    Thanks for any help and advice
     
    kentuckyslone, Mar 19, 2008 IP
  2. coldgansta

    coldgansta Guest

    Messages:
    1,614
    Likes Received:
    29
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Try this code it should do the trick!!
    Add it to your theme's functions.php
    Edit 1 in in_category(1) to the category ID # you want it to work on:




    ?php
    function nofollow_cat_posts($text) {
    global $post;
    if( in_category(1) ) {
    $text = stripslashes(wp_rel_nofollow($text));
    }

    return $text;
    }
    add_filter('the_content', 'nofollow_cat_posts');
    ?>
     
    coldgansta, Mar 19, 2008 IP
    kentuckyslone likes this.
  3. Queen Bufu

    Queen Bufu Peon

    Messages:
    10
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I thought Wordpress already made all comment links (both in name and in comments) as nofollow. So do you have to do extra coding to make links within comments nofollow?
     
    Queen Bufu, Mar 19, 2008 IP
  4. coldgansta

    coldgansta Guest

    Messages:
    1,614
    Likes Received:
    29
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Your exactly right.
    Wordpress is nofollow by default,to get the links follow you have to add code or get a plugin that will allow you to set what you want followed and nofollowed.

    He asked for the code for nofollow so i gave it him.
    Maybe he has followed links or why would he ask for the code.:confused:
     
    coldgansta, Mar 20, 2008 IP
  5. kentuckyslone

    kentuckyslone Notable Member

    Messages:
    4,371
    Likes Received:
    367
    Best Answers:
    0
    Trophy Points:
    205
    #5
    I viewed the source code and there was no "nofollow" tag on the links. The only tags on the links were target="_blank"

    I am not interested in the comments. I want to make all links within the posts nofollow
     
    kentuckyslone, Mar 20, 2008 IP
  6. kentuckyslone

    kentuckyslone Notable Member

    Messages:
    4,371
    Likes Received:
    367
    Best Answers:
    0
    Trophy Points:
    205
    #6

    I did this

    Now the links are showing rel="bookmark" How does that relate to "nofollow" I did a bit of searching and didnt see a definitive answer on that.
     
    kentuckyslone, Mar 20, 2008 IP
  7. Dubz

    Dubz Peon

    Messages:
    1,859
    Likes Received:
    156
    Best Answers:
    0
    Trophy Points:
    0
    #7
    There are plugins you can download that will do it all for you in one shot. I was looking for one that worked but the guy seems to have resdesigned his site. If you want to PM me I'll zip it up and email it to you. Super easy.

    It was made by Mattgeri.com

    Rob
     
    Dubz, Mar 20, 2008 IP
  8. kentuckyslone

    kentuckyslone Notable Member

    Messages:
    4,371
    Likes Received:
    367
    Best Answers:
    0
    Trophy Points:
    205
    #8
    kentuckyslone, Mar 20, 2008 IP