Last active
May 16, 2021 18:21
-
-
Save Zodiac1978/2f344f97a4e84701a8ca77a74a09d3d4 to your computer and use it in GitHub Desktop.
Custom Pattern for Antispam Bee: Invalid URL and only one word as name and in content
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/2f344f97a4e84701a8ca77a74a09d3d4/ | |
*/ | |
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 | |
* See: https://wordpress.org/support/topic/how-to-mark-as-spam-very-short-comments/ | |
* | |
* @param Array $patterns All RegExp patterns from ASB. | |
*/ | |
function antispam_bee_add_custom_patterns( $patterns ) { | |
$patterns[] = array( | |
'author' => '^[A-Za-z-]+$', // only one word | |
'host' => '^[A-Za-z-]+$', // only one word | |
'body' => '^[A-Za-z-]+$', // only one word | |
); | |
return $patterns; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment