Support » Fixing WordPress » 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)
  • 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;

    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.

    Check out Might be what you’re looking for.

    @iainpurdie: Thanks for posting that link! Perfect solution.

    There’s also a new plugin that will do the trick for you:

    Greg’s Comment Length Limiter

    All the best,

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Limiting Comments’ is closed to new replies.