<?php add_filter( 'pre_comment_content', 'jb_xss_comment_overflow_protection'); function jb_xss_comment_overflow_protection( $content ) { if ( strlen( $content ) > 64000 ) { wp_die( 'Invalid comment.' ); } return $content; }