Created
August 31, 2013 11:47
-
-
Save epicmonkeez/6397755 to your computer and use it in GitHub Desktop.
Remove url field from the comment form and automatically spam comments with urls
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 | |
function em_remove_comment_fields($fields) { | |
unset($fields['url']); | |
return $fields; | |
} | |
add_filter('comment_form_default_fields','em_remove_comment_fields'); | |
function em_url_spamcheck( $approved , $commentdata ) { | |
return ( strlen( $commentdata['comment_author_url'] ) > 1 ) ? 'spam' : $approved; | |
} | |
add_filter( 'pre_comment_approved', 'em_url_spamcheck', 99, 2 ); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment