WordPress Snippets at WPcustoms

Mark long comment URLs as spam

If a comment author URL is longer than 50 letters WordPress automatically marks it as spam with this short function.


/**
 * Snippet Name: Mark long comment URLs as spam
 * Snippet URL: http://www.wpcustoms.net/snippets/mark-long-comment-urls-spam/
 */
 function wpc_url_spamcheck( $approved , $commentdata ) {
return ( strlen( $commentdata['comment_author_url'] ) > 50 ) ? 'spam' : $approved;
}
add_filter( 'pre_comment_approved', 'wpc_url_spamcheck', 99, 2 );