Title: Limiting Comments
Last modified: August 19, 2016

---

# Limiting Comments

 *  [5115](https://wordpress.org/support/users/5115/)
 * (@5115)
 * [18 years, 1 month ago](https://wordpress.org/support/topic/limiting-comments/)
 * Is there a way to limit the amount of words or letters in the text area within
   the comments section so users don’t post such long comments?

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Thread Starter [5115](https://wordpress.org/support/users/5115/)
 * (@5115)
 * [18 years, 1 month ago](https://wordpress.org/support/topic/limiting-comments/#post-746802)
 * Alright, I found this code:
 *     ```
       <script type="text/javascript"><!--
       var wordLen = 255; // Maximum word length
       function checkWordLen(obj){
       var len = obj.value.split(/[\s]+/);
       if(len.length > wordLen){
       alert("You cannot put more than "+wordLen+" words in this text area.");
       obj.oldValue = obj.value!=obj.oldValue?obj.value:obj.oldValue;
       obj.value = obj.oldValue?obj.oldValue:"";
       return false;
       }
       return true;
       }
       //--></script>
       ```
   
 * and for the textarea:
    `<textarea rows="15" cols="30" name="t1" onchange="checkWordLen(
   this);"></textarea>`
 * (I know the pop-up would be annoying but, it would prevent readers posting mile
   long comments.)
 * The above code _almost_ works. But, after you hit the submit button WordPress
   still accepts the comment after getting the notice that you have entered too 
   many words. Could anyone help me implement this code so it is functional with
   WordPress? Or is there an alternative script I can use?
 * Thanks in advanced.
 *  [IainPurdie](https://wordpress.org/support/users/iainpurdie/)
 * (@iainpurdie)
 * [18 years, 1 month ago](https://wordpress.org/support/topic/limiting-comments/#post-746803)
 * Check out [http://wordpress.org/support/topic/66084?replies=2](http://wordpress.org/support/topic/66084?replies=2).
   Might be what you’re looking for.
 *  Thread Starter [5115](https://wordpress.org/support/users/5115/)
 * (@5115)
 * [18 years, 1 month ago](https://wordpress.org/support/topic/limiting-comments/#post-746819)
 * [@iainpurdie](https://wordpress.org/support/users/iainpurdie/): Thanks for posting
   that link! Perfect solution.
 *  [gregmulhauser](https://wordpress.org/support/users/gregmulhauser/)
 * (@gregmulhauser)
 * [17 years, 3 months ago](https://wordpress.org/support/topic/limiting-comments/#post-746995)
 * There’s also a new plugin that will do the trick for you:
 * [Greg’s Comment Length Limiter](https://wordpress.org/support/topic/limiting-comments/wordpress.org/extend/plugins/gregs-comment-length-limiter/?output_format=md)
 * All the best,
    Greg

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Limiting Comments’ is closed to new replies.

## Tags

 * [Comments](https://wordpress.org/support/topic-tag/comments/)
 * [textarea](https://wordpress.org/support/topic-tag/textarea/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 4 replies
 * 3 participants
 * Last reply from: [gregmulhauser](https://wordpress.org/support/users/gregmulhauser/)
 * Last activity: [17 years, 3 months ago](https://wordpress.org/support/topic/limiting-comments/#post-746995)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
