Last active
May 16, 2021 13:17
-
-
Save Zodiac1978/19c5b045515ee62b09702361369ea38f to your computer and use it in GitHub Desktop.
Custom Pattern for Antispam Bee: Everything is spam with 6 numbers only *and* yandex.ru or yandex.com in the email field:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: Custom Patterns for Antispam Bee | |
* Description: Add custom patterns for Antispam Bee. | |
* Plugin URI: https://torstenlandsiedel.de | |
* Version: 1.0 | |
* Author: Torsten Landsiedel | |
* Author URI: https://torstenlandsiedel.de | |
* Licence: GPL 2 | |
* License URI: http://opensource.org/licenses/GPL-2.0 | |
* Gist Plugin URI: https://gist.github.com/Zodiac1978/19c5b045515ee62b09702361369ea38f/ | |
*/ | |
if ( ! defined( 'ABSPATH' ) ) { | |
exit; // Exit if accessed directly. | |
} | |
/** | |
* Antispam Bee filter for custom RegExp patterns | |
*/ | |
add_filter( 'antispam_bee_patterns', 'antispam_bee_add_custom_patterns' ); | |
/** | |
* Add more RegExp patterns | |
* | |
* @param Array $patterns All RegExp patterns from ASB. | |
*/ | |
function antispam_bee_add_custom_patterns( $patterns ) { | |
$patterns[] = array( | |
'body' => '^[1-9]{6}$', | |
'email' => '@yandex\.(ru|com)', | |
); | |
return $patterns; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment