How to Remove NoFollow From WordPress Comments
  • September 29

How to Remove NoFollow From WordPress Comments

Sometimes you just need to remove NoFollow links from comments located in your sites using WordPress themes. How do you get automatic NoFollow links:
  • At first someone commented on your website;
  • WordPress template added to each link in the text of the comment the automatic attribute NoFollow;
  • This comment was included into the database along with the NoFollow reference;
  • When displaying text commentary treated and disposed of nofollow every link through expressions.

How it should be done with the greater good for your website using one of WooCommerce themes:
  • Someone adds a comment;
  • The comment was included into the database without NoFollow attribute.
So much for the links in the text of the comment, when you remove NoFollow from the author's name, everything happens a little differently:
Just one line of code to be copied into the functions.php:
remove_filter ('pre_comment_content', 'wp_rel_nofollow', 15); Note: If adding rel = "nofollow" when posting a comment manually, the attribute is removed. Also, do not be affected by old comments on the blog, which has already entered into the database with NoFollow attribute.

Remove from NoFollow links in the author's name manually directly from WordCommerce themes

The manual method is based on editing a file comment-template.php, which is located in \ wp-includes \. This file is necessary to remove all the rel = "nofollow" and rel = "external nofollow". The method works, but it does have one major drawback: when you upgrade WordPress again have to edit this file.
2(1) There is a more versatile way to get rid nofollow blog without editing files engine. It is based on the use of the filter, which is written in the file functions.php. Open this file and add the following lines: function comment_author_link_follow_innewwindow () { global $ comment; $ url = get_comment_author_url (); $ author = get_comment_author (); if (empty ($ url) || 'http: //' == $ url) $ return = $ author; else $ return = "<a href='$url' rel='external' target='_blank'> $ author </a>"; return $ return;} add_filter ('get_comment_author_link', 'comment_author_link_follow_innewwindow'); This filter removes the nofollow links to the authors' comments that lead to their websites. And to remove the nofollow links in the text of the comment and the text of posts, add a filter: function remove_nofollow ($ string) {$ string = str_ireplace ('rel = "nofollow"', '', $ string); return $ string;} add_filter ('the_content', 'remove_nofollow'); // Remove the nofollow for texts of posts add_filter ('comment_text', 'remove_nofollow'); // Remove the nofollow for comments in text If you have not used a rel = "nofollow", and rel = "external nofollow", then you need to add another filter: function remove_nofollow ($ string) {$ string = str_ireplace ('rel = "external nofollow"', '', $ string); return $ string;} add_filter ('the_content', 'remove_nofollow'); // Remove the nofollow from texts in posts add_filter ('comment_text', 'remove_nofollow'); // Remove the nofollow for comments How to remove NoFollow from posts and comments in WordPress themes? To do this, just need to open the file function.php site template and write in it the following code: function remove_nofollow ($ string) { $ string = str_ireplace ('rel = "nofollow"', '', $ string); return $ string;} add_filter ('the_content', 'remove_nofollow'); add_filter ('comment_text', 'remove_nofollow');
Benefits of using dofollow blogs with WooCommerce themes:
  • A large number of people who will leave comments just for reference;
  • The more performance TIC and PR of your blog, the more likely people will comment;
  • Your blog can get into directories dofollow-blogs that can bring additional ones.
If you have any questions please use our support or the forum where people discuss different issues connected with WooCommerce themes.

Did you know ?

One standard license is valid only for 1 project. Running multiple projects on a single license is a copyright violation.

We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.