Skip to content

Instantly share code, notes, and snippets.

@stebrech
Created September 3, 2014 11:35
Show Gist options
  • Save stebrech/56bcacf8f42f16473b08 to your computer and use it in GitHub Desktop.
Save stebrech/56bcacf8f42f16473b08 to your computer and use it in GitHub Desktop.
Automatically spam comments with a very long url – http://www.catswhocode.com/blog/best-wordpress-snippets-hacks-and-tips-from-2013
<?php
function url_spamcheck( $approved , $commentdata ) {
return ( strlen( $commentdata['comment_author_url'] ) > 50 ) ? 'spam' : $approved;
}
add_filter( 'pre_comment_approved', 'url_spamcheck', 99, 2 );
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment