Require minimum comment length in wordpress

Go to source

snippet :  PHP – functions.phpcopy
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;
}


Require minimum comment length in wordpress is a post from: wpsnipp.com - WordPress Snippets, Code, Hacks, 590+ for your theme, blog
which is not allowed to be copied on other sites.”

Share this post.


Require minimum comment length in wordpress">Facebook | Require minimum comment length in wordpress">StumbleUpon | Require minimum comment length in wordpress">Delicious | Require minimum comment length in wordpress @wpsnipp">Tweet It | Require minimum comment length in wordpress">Digg This

© wpsnipp.com All Rights reserved.

source: wpsnipp.com