Created
May 16, 2013 14:46
-
-
Save cowgill/5592248 to your computer and use it in GitHub Desktop.
Block all WordPress comments that try include a url.
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
+// check honeypot field when a new comment is submitted | |
+// we hide the url field from normal visitors via css | |
+function at_pre_comment_check() { | |
+ | |
+ if ( ! empty( $_POST['url'] ) ) | |
+ wp_die( "Comment rejected because it triggered our spam filter. Disable any auto form filler and try again." ); | |
+ | |
+} | |
+add_action( 'pre_comment_on_post', 'at_pre_comment_check' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment