Skip to content

Instantly share code, notes, and snippets.

@shemul49rmc
Created December 13, 2013 09:40
Show Gist options
  • Save shemul49rmc/7942026 to your computer and use it in GitHub Desktop.
Save shemul49rmc/7942026 to your computer and use it in GitHub Desktop.
Minimum Comment Limit In WordPress
//Minimum Comment Limit In WordPress by http://goo.gl/ht6fZo//
add_filter( 'preprocess_comment', 'minimal_comment_length' );
function minimal_comment_length( $commentdata ) {
$minimalCommentLength = 15;
if ( strlen( trim( $commentdata['comment_content'] ) ) < $minimalCommentLength )
{
wp_die( 'All comments must be at least ' . $minimalCommentLength . ' characters long.' );
}
return $commentdata;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment