How to Control Comment Length in WordPress

A2Hosting for WordPress

Comment plays a vital role in blogging and we are bloggers know the importance of blog commenting. Comments help us in several ways to get success in online business or blogging industry. This is one of the most effective ways to build a strong online community as well as rank our blog better in SERPs. So most of the bloggers let their visitors to drop valuable comments on their blog posts.

But the problem is the spam comments. If you are a blogger, you may receive huge spam and unwanted comments every day. Most of the comments dropped by spammers to get backlinks only and these comments contain no value. As a blogger, you must want some valuable comments from your readers that will help your content better in SERPs. You may use several tools or plugins to control spam and unworthy comments but fail to control.How to Control Comment Length in WordPress

So here is a better solution for you. You can control spam comments easily by controlling comment length in your WordPress blog. Here, I’m going to share How to Control Comment Length in WordPress. Just follow these steps to limit or control comment length that will help you to get huge valuable comments as well as knock out spam comments.

Control Comment Length Using Code Snippet

You can easily Set Comment Limit in WordPress using simple code snippet. You can set minimum and maximum length of characters in comments using code snippet. When visitors let a comment less than minimum character length or more than maximum character length, they will see an error message that you set.

Simply add these following codes in your theme functions.php file.

add_filter( ‘preprocess_comment’, ‘wpb_preprocess_comment’ );

function wpb_preprocess_comment($comment) {

if ( strlen( $comment[‘comment_content’] ) > 3000 ) {

wp_die(‘Comment is too long. Please keep your comment under 3000 characters.’);

}

if ( strlen( $comment[‘comment_content’] ) < 30 ) {

wp_die(‘Comment is too short. Please use at least 30 characters.’);

}

return $comment;

}

Set Comment Length Using Plugin

As it is not a good idea to use plugin in WordPress because it may effect in blog/site loading time. But there are several Free WordPress Plugins available which you can use to set comment length in WordPress. The Control Comment Length is a simple plugin which comes with simple and user friendly interface. Just install and set the maximum and minimum number of character for comments. You can also use the Greg’s Comment Length Limiter plugin to control comment length in WP blog.

Top 100 High PR Free Directory Submission Sites List 2016
Top 100 High PR Forum Posting Sites List 2015

One Response

  1. Trisha Dey October 28, 2015

Leave a Reply

CommentLuv badge

Buy Any MyThemeShop Theme or Plugin With a Big Discount! (Coupon: LimitedOffer)Buy Now!