Mark Comments with Very Long URLs as Spam

<?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 );

?>

Note: The snippet below allows you to mark a comment as spam that has a website URL over 50 characters. You can increase or decrease this limit to suit your own needs.

Leave a Reply

Your email address will not be published. Required fields are marked *