If you do not have the method I said earlier to block all English, use the following code:
//all comments in English and Japanese are prohibitedfunctionBymt_comment_post ($incoming _comment ) {$pattern= '/[-Calls]/u ';$jpattern= '/[ぁ-ん]+| [ァ-ヴ]+/u ';if(!Preg_match($pattern,$incoming _comment[' Comment_content ']) {Err ("Write some Chinese character bar, Bo Master foreign language very catch urgent!" Please write some Chinese words! " );}if(Preg_match($jpattern,$incoming _comment[' Comment_content ']) {Err ("Japanese roll thick!" Japanese Get out! Japanese language out てきに line けます! " );}return($incoming _comment );} Add_filter (' Preprocess_comment ', ' bymt_comment_post ');
If you've already used a code that blocks all English, use the following code:
// Forbidden Japanese Comments function $incoming _comment ) {$jpattern = '/[ぁ-ん]+| [ァ-ヴ]+/u '; if (preg_match($jpattern$incoming _comment[' comment_content '"Japanese roll thick! Japanese Get out! Japanese language out てきに line けます! " );} return $incoming _comment );} Add_filter (' preprocess_comment ', ' bymt_comment_jp_post ');
Of course, not only these, but through the above principles we can also block other language spam comments:
Forbidden Russian Comments:
// no messages from savages in the North (Russian) function $incoming _comment {$ruattern = '/[а-я]+/u '; if (preg_match($ruattern$incoming _comment[' comment_content '] We do not welcome the words of the Northern savages! Russians, get away! savageвыйтиизрусскогосевера! " );} return $incoming _comment );} Add_filter (' preprocess_comment ', ' bymt_comment_ru_post ');
No Korean comments:
// A message to the people of the Korean Peninsula for Happiness (Korean/Korean) function $incoming _comment ) {$krattern = '/[?-?] +| [?-?] +| [?-?] +| [?-?] +| [?-?] +| [?-?] +| [?-?] +/u '; if (preg_match($krattern$incoming _comment[' comment_content '"do not use Korean/Korean to think of Tantra! Please don't use korean!??? ???? ?? / ??? ???? ????! " );} return $incoming _comment );} Add_filter (' preprocess_comment ', ' bymt_comment_kr_post ');
Forbidden Arabic Comments:
// No Messages Allah Allah (Arabic, part) function $incoming _comment ) {$arattern = '/[?-?] +| [?-?] +| [?-?] +/u '; if (preg_match($arattern$incoming _comment[' comment_content '"don't use Arabic! Please don't use arabic!!?? ???? ?? ?????? ????? ???????" );} return $incoming _comment );} Add_filter (' preprocess_comment ', ' bymt_comment_ar_post ');
Thai comments are forbidden:
// No Shemale tribe messages (Thai) function $incoming _comment ) {$thattern = '/[?-?] +/u '; if (preg_match($thattern$incoming _comment[' comment_content '"shemale hello, shemale goodbye! Please don't use thai!???????????????????! " );} return $incoming _comment );} Add_filter (' preprocess_comment ', ' bymt_comment_th_post ');
Source: http://www.luoxiao123.cn/6129.html
WordPress non-plug-in implementation of shielding English, Japanese, Russian, Korean, Arabic, Thai and other foreign language spam reviews!