Skip to content

Instantly share code, notes, and snippets.

@hereswhatidid
Created April 27, 2015 18:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hereswhatidid/ad365893f64f0d4f9b92 to your computer and use it in GitHub Desktop.
Save hereswhatidid/ad365893f64f0d4f9b92 to your computer and use it in GitHub Desktop.
WordPress 4.2 comment fix - this will disable any comment over a certain lenght that could theoretically trigger the XSS vulnerability.
<?php
add_filter( 'pre_comment_content', function( $content ) {
if ( strlen( $content ) > 64000 )
wp_die( 'Invalid comment.' );
return $content;
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment