Skip to content

Instantly share code, notes, and snippets.

@Zodiac1978
Last active May 16, 2021 13:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Zodiac1978/19c5b045515ee62b09702361369ea38f to your computer and use it in GitHub Desktop.
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:
<?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