In fact, lunjia didn't want to send new articles so quickly, so they took down all the beautiful and moving Jade photos. we all know that comments on the wordpress blacklist will be automatically marked as spam comments. This is a waste of resources. After all, spam comments are still written into the database. If a large number of spam attacks occur during a concentrated period, this blacklist mechanism does not help protect the database. However
In fact, lunjia didn't want to send new articles so quickly, so they took down all the beautiful and moving Jade photos. we all know that comments on the wordpress blacklist will be automatically marked as spam comments. This is a waste of resources. After all, spam comments are still written into the database. If a large number of spam attacks occur during a concentrated period, this blacklist mechanism does not help protect the database. However
In fact, lunjia didn't want to send new articles so quickly, so they took down all the beautiful and moving Jade photos.
We all know that comments on the wordpress blacklist will be automatically marked as spam comments. This is a waste of resources. After all, spam comments are still written into the database. If a large number of spam attacks occur during a concentrated period, this blacklist mechanism does not help protect the database,
Then I wrote a function to directly reject comments that meet the blacklist conditions and the comments will not be written to the database.
Method A: run the following code on functions. php:
Function xhd_fuckspam ($ comment) {if (is_user_logged_in () {return $ comment;} // no pressure on the login user... if (wp_blacklist_check ($ comment ['comment _ author '], $ comment ['comment _ author_email'], $ comment ['comment _ author_url '], $ comment ['comment _ content'], $ comment ['comment _ author_IP '], $ comment ['comment _ agent']) {header ("content-type: text/html; charset = UTF-8 "); exit ('grass you paralyze spam comment rough ');} else {return $ comment ;}} add_filter ('preprocess _ comment ', 'xhd _ fuckspam ');
Method B: run the following code to throw the comments-ajax.php(Find a place, for exampleChecking comments is too fastAfter that function)
If (wp_blacklist_check ($ comment_author, $ comment_author_email, $ comment_author_url, $ comment_content )&&! Is_user_logged_in () {// log on to the user without pressure... err (_ ('grass you paralyze spam comment rough '));}
The effects and principles of the two methods are slightly different,
:
You can test it by yourself. Method: Replace the nickname you commented on here
BagsOr
Louis(These are all in_array In the butterfly blacklist) and then submit the comments. Feel the rest.
Fuck-spam is coded by xiaohudie. Any posts here is one hundred percent original, so please keep my link so as not to hurt this pretty girl