Dumb wp Question about links relating to SEO.

Bostoncab

Elite Member
Dec 31, 2009
2,256
514
So we all know that links coming into your blog are good. The better and more links G sees at a steady rate the higher you rank for targeted keywords.

Now I never really understood outbound links from your blog to outher sites and how that hurts seo.

I know too many outbound links are bad and if you have outbound links they should be no follow.

I have an autoblog set up that uses the autoblogged software. Every post it makes it drops a link back to the original article. So I must have hunreds of outbound links on my blog by now.

Is there a way to set WP so that all outbound links are no follow? Meaning the link will still work but G won`t penalize me for the link because I have the no follow?
 
Yes! you can do that by adding a External No follow function!!

So, your site will still have internal links to your pages, and all the other links will be NoFollow and hence you wont loose your Ranking to other sites!!

Crack your functions.php and you can do what you just asked for!


Add this to your functions.php

Code:
add_filter('the_content', 'my_nofollow');

function my_nofollow($content) {
    //return stripslashes(wp_rel_nofollow($content));
    
    return preg_replace_callback('/<a[^>]+/', 'my_nofollow_callback', $content);
}

function my_nofollow_callback($matches) {
    $link = $matches[0];
    $site_link = get_bloginfo('url');

    if (strpos($link, 'rel') === false) {
        $link = preg_replace("%(href=\S(?!$site_link))%i", 'rel="nofollow" $1', $link);
    } elseif (preg_match("%href=\S(?!$site_link)%i", $link)) {
        $link = preg_replace('/rel=\S(?!nofollow)\S*/i', 'rel="nofollow"', $link);
    }
    return $link;
}


~ExP~
 
Back
Top
AdBlock Detected

We get it, advertisements are annoying!

Sure, ad-blocking software does a great job at blocking ads, but it also blocks useful features and essential functions on BlackHatWorld and other forums. These functions are unrelated to ads, such as internal links and images. For the best site experience please disable your AdBlocker.

I've Disabled AdBlock