duskosobic
1/25/2017 - 10:59 PM

Spam Comments with Very Long URL’s. Super long URL's are a sure fire sign the comment is spammy. This will mark comments with URL's (as the

Spam Comments with Very Long URL’s. Super long URL's are a sure fire sign the comment is spammy. This will mark comments with URL's (as the author URL, not just in the text) longer than 50 characters as spam, otherwise leave their state the way it is.

<?php

  function rkv_url_spamcheck( $approved , $commentdata ) {
    return ( strlen( $commentdata['comment_author_url'] ) > 50 ) ? 'spam' : $approved;
  }

  add_filter( 'pre_comment_approved', 'rkv_url_spamcheck', 99, 2 );

?>