Skip to:
Content
Pages
Categories
Search
Top
Bottom

Remove NoFollow from BBPress Posts


  • DevynCJohnson
    Participant

    @devyncjohnson

    How can I prevent “nofollow” from being added to my internal links on bbPress posts? (I have the latest version of bbPress and WordPress)

    The “nofollow” attribute is being added to my internal links on my website (DCJTech.info). However, this issue only occurs on bbPress posts, but not WordPress pages. Here is an example of the problem (bbPress post) – http://dcjtech.info/topic/general-unixoid-topics/

    I have tried commenting out the below lines from ./includes/core/filters.php, but without success. I also cleared the cache (server and browser) and waited a minute before checking the page’s source code.

    add_filter( 'bbp_get_reply_content', 'bbp_rel_nofollow',   50   );
    add_filter( 'bbp_get_topic_content', 'bbp_rel_nofollow',   50   );

    I used ‘grep -r -e “follow” ./plugins‘ to find all code that may be inserting “nofollow”, and I also searched my theme and mu-plugins. In addition, I searched my SQL database (via phpMyAdmin) for “follow”. I did not find any plugin, setting, etc. that could be causing this problem. There were no “nofollow” attributes in the posts either. I also searched my plugins for “bbp_rel_nofollow”.

    I disabled “External Links” and commented out the previously mentioned bbPress code (and cleared the cache), but the “nofollow” attribute was still on my internal links.

    I thoroughly checked the WordPress codex website, forums (like https://bbpress.org/forums/topic/turning-no-follow-links-to-do-follow/ ), etc., but I cannot find a solution or cause.

Viewing 7 replies - 1 through 7 (of 7 total)

  • DevynCJohnson
    Participant

    @devyncjohnson

    As a temporary (but poor fix) the below code can be added to “functions.php”.

    //Remove nofollow
    function rm_nofollow($txt){
        $txt=str_replace(' rel="nofollow"','',$txt);
        return $txt;
    }
    add_filter('bbp_get_topic_content','rm_nofollow',20);
    add_filter('bbp_get_reply_content','rm_nofollow',20);

    lyndysmart
    Participant

    @lyndysmart

    Interesting. I have to check my installation. Thanks devyn for bringing the info here


    Robkk
    Moderator

    @robkk

    @devyncjohnson

    That works fine. Glad you solved your own issue! 🙂


    DevynCJohnson
    Participant

    @devyncjohnson

    @Robkk , not necessarily. The “fix” is not 100% perfect because it removes “nofollow”s that I intend to keep for external domains/links. Also, if I were to write an article about nofollow, then any code examples I give will lose

    rel="nofollow"

    The fix I provided is a poor fix. True, it solves my problem at the cost of a much lesser evil (in my opinion). I still hope that someone can provide a real solution or explain where the nofollow is coming from. Until then, at least I have a fix which is better than no fix.

    Considering that I commented out those lines in the bbPress plugin, one would think that that would fix everything.

    Hi @devyncjohnson,

    I see nofollow adding for bbpress on the following places:
    – line 344 of wp-content/plugins/bbpress/includes/core/functions.php
    – line 1703 of wp-content/plugins/bbpress/includes/replies/template.php

    Also check:
    – line 298 of wp-content/plugins/bbpress/includes/common/formatting.php

    Maybe you will find what you look for.
    Pascal.


    Robkk
    Moderator

    @robkk

    I think there is an issue with the bbp_make_clickable() function that is causing this especially the part that leads to the function _make_url_clickable_cb() in WordPress.

    bbp_make_clickable() is in

    \bbpress\includes\common\formatting.php

    bbp_make_clickable

    _make_url_clickable_cb() is in

    \wp-includes\formatting.php

    _make_url_clickable_cb()

    Will make a trac ticket once I gather the information to write down.


    Robkk
    Moderator

    @robkk

    @devyncjohnson

    I talked to the devs awhile back on this, and as long as you insert the links manually with html or with the link quicktag button, your links shouldn’t have a rel=”nofollow”.

    Just add this to your functions.php file your child theme instead of commenting out the code.

    remove_filter( 'bbp_get_reply_content', 'bbp_rel_nofollow',   50   );
    remove_filter( 'bbp_get_topic_content', 'bbp_rel_nofollow',   50   );
Viewing 7 replies - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.
Skip to toolbar