WordPress.org

Forums

Please help me change rel="nofollow links to dofollow (7 posts)

  1. Mike Hardaker
    Member
    Posted 1 year ago #

    We had a plugin installed that changed all of our links to nofollow. The plugin has been removed but the rel="nofollow is still located in the html of each article.

    You can view the source here: http://mtnweekly.com/never-summer-ripsaw-review-63027

    Is there a way to make all the links on our site show up as dofollow? A plugin? A line of code we can insert into the functions.php

  2. Christian1012
    Member
    Posted 1 year ago #

    You can try this, which will filter the_content, and replace rel="nofollow" with an empty space.

    function mtn_weekly_fix_rel_follow( $content ) {
        // Find rel="nofollow", replace with empty space.
        $content = preg_replace( '/rel="nofollow"/', ' ', $content);
        return $content;
    }
    add_filter( 'the_content', 'mtn_weekly_fix_rel_follow', 20 );
  3. Mike Hardaker
    Member
    Posted 1 year ago #

    Thanks for the reply however this seemed to break the site. Any other suggestions?

  4. Christian1012
    Member
    Posted 1 year ago #

    Try this...

    function mtn_weekly_fix_rel_follow( $content ) {
        // Find rel="nofollow", replace with empty space.
        $content = preg_replace( '(rel="nofollow")', ' ', $content);
        return $content;
    }
    add_filter( 'the_content', 'mtn_weekly_fix_rel_follow', 20 );
  5. Christian1012
    Member
    Posted 1 year ago #

    Scratch that...when you say it broke your site, what do you mean. That's a simple find and replace filter on the content of your site.

  6. Mike Hardaker
    Member
    Posted 1 year ago #

    still having no luck with this. I guess we could go through the 2500 articles and manually change all the nofollow to do follow links?

    Any other suggestions?

    http://mtnweekly.com

  7. Aaron
    Member
    Posted 1 year ago #

    I'd use a plugin like http://wordpress.org/plugins/search-and-replace/

    First off do a search for rel="nofollow" and see what results it returns.

    Then after you think it is safe and only will change what you want do a search and replace to remove them all.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.