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: https://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 ); 

0 0 vote
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x