Skip to content

Instantly share code, notes, and snippets.

@Zodiac1978
Created January 1, 2017 18:26
Show Gist options
  • Save Zodiac1978/37dc557cd6873ba9e8590fb0a6ada8d0 to your computer and use it in GitHub Desktop.
Save Zodiac1978/37dc557cd6873ba9e8590fb0a6ada8d0 to your computer and use it in GitHub Desktop.
Antispam Bee filter for custom RegExp patterns
<?php
/**
* Antispam Bee filter for custom RegExp patterns
* See: https://github.com/sdellenb/twentyfifteen-rubenesque-child/blob/master/functions.php#L14-L45
*/
add_action(
'init',
'antispam_bee_patterns'
);
function antispam_bee_patterns() {
add_filter(
'antispam_bee_patterns',
'antispam_bee_add_custom_patterns'
);
}
function antispam_bee_add_custom_patterns($patterns) {
// Pattern for phony author names.
// Fun Fact: The last one is 'Prada' in Japanese.
$patterns[] = array(
'author' => 'moncler|north face|vuitton|handbag|burberry|outlet|dress|maillot|oakley|ralph lauren|ray ban|iphone|プラダ'
);
// Pattern for phony web pages.
$patterns[] = array(
'host' => '^(www\.)?fkbook\.co\.uk$|^(www\.)?nsru\.net$|^(www\.)?goo\.gl$|^(www\.)?bit\.ly$'
);
// Pattern for text containing strings like 'targetted visitors'.
$patterns[] = array(
'body' => 'target[t]?ed (visitors|traffic)'
);
return $patterns;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment