Set minium comment length
Get rid of poor comments like “cool post!” by setting a mimium character count.
/** * Snippet Name: Set minium comment length * Snippet URL: https://wpcustoms.net/snippets/set-minium-comment-length/ */ function wpc_minimal_comment_length( $commentdata ) { $minimalCommentLength = 20; if ( strlen( trim( $commentdata['comment_content'] ) ) < $minimalCommentLength ) { wp_die( 'All comments must be at least ' . $minimalCommentLength . ' characters long.' ); } return $commentdata; } add_filter( 'preprocess_comment', 'wpc_minimal_comment_length' );