Add no follow to external links

This topic contains 8 replies, has 2 voices, and was last updated by  P O 4 years, 5 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #515525

    P O
    Expired Member
    Post count: 501

    For Website, Facebook, Twitter, Instagram and so on, how can I add nofollow to some of them?

    Thanks.

    #515528

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    All external links are nofollow by default.

    Stiofan

    #515530

    P O
    Expired Member
    Post count: 501

    How can I make some dofollow then?

    The idea is to control and have both types of links when needed.

    Thanks.

    #515532

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    We don’t have a setting for that yet but you can use a filer (not tested) something like

    add_filter('geodir_custom_field_output_url','_my_remove_nofollow_from_urls',15,5);
    function _my_remove_nofollow_from_urls($html,$location,$cf,$p='',$output=''){
    
    if(isset($cf['htmlvar_name']) && $cf['htmlvar_name']=='facebook){
       $html = str_replace('rel="nofollow"', '', $html);
    }
       return $html;
    }

    Stiofan

    #515678

    P O
    Expired Member
    Post count: 501

    So if I want to remove nofollow for websites I have to enter all my existing URLS?

    #515900

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    You could do it either way, you could have a include or exclude list.

    Stiofan

    #515910

    P O
    Expired Member
    Post count: 501

    That means that if I have 85,000 places, I have to add 85,000 IDs?

    Thanks.

    #515927

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    no, not sure how u got to that conclusion…

    This will remove it for all, you can add in your own conditions if u want to block it for some urls or fields.

    add_filter('geodir_custom_field_output_url','_my_remove_nofollow_from_urls',15,5);
    function _my_remove_nofollow_from_urls($html,$location,$cf,$p='',$output=''){
    
    if(isset($cf['htmlvar_name']) ){
       $html = str_replace('rel="nofollow"', '', $html);
    }
       return $html;
    }

    Stiofan

    #515928

    P O
    Expired Member
    Post count: 501

    Thank you.

    What does 15,5 does?

Viewing 9 posts - 1 through 9 (of 9 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket