Wordpress: how to shield comments

Source: Internet
Author: User

When you post comments on a wordpress site, if you fill in the site url, a hyperlink is automatically added to the reviewer's name. If you do not want to add this link, you can use the following methods to block it.

Add the code to functions. php in the topic folder:

The code is as follows: Copy code

Add_filter ('Get _ comment_author_link ', 'web589 _ comment_author_link ');
Function web589_comment_author_link ($ link ){
$ Args = array ('/<a. *?> /','/</A> /');
$ Link = preg_replace ($ args, '', $ link );
Return $ link;
}

Another method is to add nofollow to the connection.


1. Open the comment-template.php file under the wp-topics folder
2. Find the $ return = "<a href = '$ url' rel = 'external nofollow' class = 'URL'> $ author </a>" statement.
3. Change the link to a href = '/go. php? $ URL'
4. Replace Upload

Similarly, you can modify the formatting. Php file in the wp-nodes des folder and modify the link structure written in the comments.

The code is as follows: Copy code
Return $ matches [1]. "<a href =" $ url "rel =" nofollow "> $ url </a> ";

Go. php:

The code is as follows: Copy code

<? Php
Header ("location:". $ _ SERVER ['redirect _ QUERY_STRING ']);
?>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.