Created
March 21, 2017 07:42
-
-
Save Kaiderella/c25b22f227e0c2a503f000ef976c5197 to your computer and use it in GitHub Desktop.
Yêu cầu độ dài tối thiểu của bình luận
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( 'preprocess_comment', 'minimal_comment_length' ); | |
function 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; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment