In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
How to solve the problem that WordPress is spammed by mass comments? Many novices are not very clear about this. In order to help you solve this problem, the following editor will explain it in detail. People with this need can come and learn. I hope you can gain something.
Many of our netizens have reported that during the construction of the WordPress site, we found that there are a lot of spam comments in the background every day, and it seems that these comments are sent in a non-manual group. Indeed, we may encounter a lot of spam comments sent by the software, such as seeing a lot of English messages. This information will increase our daily deletion time cost, and it is also bad for the website. Is there any way for us to solve this problem?
We may have more ways to add comment verification, and we need to enter a CAPTCHA or other verification mechanism when commenting, which is also a good way. Today, what we need to introduce in our WordPress class is that we can block these comments through two pieces of code.
First, the comment content needs to be in Chinese.
What we see in the comments is English or other languages, not Chinese. Then we must comment that there is Chinese in the content.
/ / Chinese cnwper.comfunction wp_refused_spam_comments ($comment_data) {$pattern ='/ [one-word] / upright _ character _): / / Chinese cnwper.comfunction wp_refused_spam_comments ($comment_data) {$pattern ($pattern, $comment_data ['comment_content']) ;} if (preg_match ($jpattern, $comment_data ['comment_content']) {err (_ (' cannot have Japanese!')) ;} return ($comment_data);} add_filter ('preprocess_comment',' wp_refused_spam_comments')
Second, prohibit links in comments.
Many people go to the blog to comment and leave comments in order to promote the website. if we ban links, there are not many people to post comments.
/ / prohibit sending link cnwper.comfunction wp_comment_post ($incoming_comment) {$http ='/ [href= "| rel=" nofollow "| http://|]/u';if(preg_match($http, $incoming_comment ['comment_content']) {err (" prohibit sending link address! ");} return ($incoming_comment);} add_filter (' preprocess_comment', 'wp_comment_post')
As simple as that, add two pieces of code to the Functions.php file in the current WordPress theme.
For more WordPress technical articles, please visit the WordPress skills section!
Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.