Greg's Comment Length Limiter

Description

NOTE: Please do NOT use the WordPress forums to seek support for this plugin. Support for GCLL is handled on our own site.

This plugin provides a configurable limit on the length of comments left in the comment form, with a character countdown displayed for the user and dynamically updated with each keypress.

My complete portfolio of 50 plugins, including this one, and also including the new Faster Cache for WordPress is now available for adoption!

New in This Version

  • On WordPress 4.5 and above, the plugin now includes additional enforcement of the comment length limit by modifying WordPress’s hard-coded default maxlength of 65525 for the comment form’s textarea.

Background

Most of us welcome comments on our blog posts, but that doesn’t necessarily mean that we — or our readers — like to see comments reaching into thousands of words. Readers may be discouraged from commenting themselves (or reading comments at all) when they see very long entries left by others, and during times of high load, the significant performance overheads associated with retrieving and displaying long comments can slow even the speediest dedicated servers.

From the perspective of SEO (search engine optimization), very long comments also dilute the impact of the author’s original post by relegating it to a small proportion of the overall content available on the page. For advanced SEO capabilities, see Greg’s High Performance SEO Plugin.

The primary approach to limiting the total volume of comment material displayed on a page has long been to break up comments across several pages, usually with the built-in paged comment feature introduced in WordPress 2.7.

This plugin provides one more tool by directly limiting the length of any one comment. A lightweight JavaScript counter — just 5 lines of inline JavaScript, with no gigantic external libraries to load — lets the user know how many characters they have left to complete their entry. Any additional text which might be inserted beyond the configured limit via cutting and pasting is automatically trimmed to length.

For users without JavaScript, the counter degrades gracefully, providing a visual indication of the preferred (but unenforced) length limit, without the countdown feature.

For coders, the plugin provides additional configuration options via direct calls.

Fine Print

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 3 as published by the Free Software Foundation.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

Screenshots

  • Comment length limiter plugin in use with the default theme
  • Basic comment length limiter configuration options

FAQ

NOTE: Please do NOT use the WordPress forums to seek support for this plugin. Support for GCLL is handled on our own site.

Reviews

Read all 5 reviews

Changelog

1.7, 15 April 2016

  • On WordPress 4.5 and above, the plugin now includes additional enforcement of the comment length limit by modifying WordPress’s hard-coded default maxlength of 65525 for the comment form’s textarea.

1.6.5, 13 November 2015

  • Minor changes to admin panel formatting

1.6.4, 5 March 2015

  • Updates to documentation and code improvements
  • Note on portfolion of plugins now available for adoption

1.6.3, 10 January 2015

  • Fixed potential XSS vulnerability which could affect administrators who are logged in using an old browser and who visit a maliciously crafted URL on their own site. Thanks to Kacper Szurek for responsible disclosure of this problem in a different plugin.

1.6.2, 19 December 2014

  • Note on WordPress 4.1 compatibility.

1.6.1, 8 October 2014

  • Documentation update and note on WordPress 4.0 compatibility.

1.6, 23 April 2014

  • Noted compatibility with WordPress 3.9.

1.5.9, 22 November 2013

  • Dropped compatibility with very old versions of PHP no longer supported by WordPress.

1.5.8, 21 September 2013

  • Updated WordPress version compatibility.

1.5.7, 15 December 2012

  • Replaced some ancient admin page code to enable loading the plugin through a symbolic link.
  • Confirmed 3.5 compatibility.

1.5.6, 26 November 2011

  • Removed PluginSponsors.com code following threats that the plugin would be expelled from the plugin repository for using the code to display sponsorship messages

1.5.5, 27 October 2011

  • Documentation updates

1.5.4, 3 October 2011

  • Minor code cleanups
  • Tweak to accommodate automatic placement within Twenty Eleven’s pixel-level hard-coded comment form styling. (Remember, the countdown box is available for styling yourself, so please do modify how you would like to appear with your own theme: it is not possible to include universal CSS that works with every theme available.)

1.5.3, 5 Feburary 2011

  • Better customisation options for WordPress 3.0+ comment_form filters

1.5.2, 29 January 2011

  • Minor code cleanup
  • Testing with WP 3.1 Release Candidate 3

1.5.1, 20 January 2011

  • Minor code cleanup
  • Testing with WP 3.1 Release Candidate 2

1.5, 12 September 2010

  • Improved counter box placement options for WordPress 3.0’s new comment_form function
  • Improved counter removes dependence on an explicit ‘name’ attribute for the comment form, relying on ‘id’ instead
  • Improved comment length accuracy for multi-byte character sets when using anti-spam comment trimming

1.4.2, 24 June 2010

  • Better workaround for WordPress 3.0’s problems initialising plugins properly under multisite

1.4.1, 24 June 2010

  • Workaround for rare problem where WordPress interferes with a newly activated plugin’s ability to add options when using multisite/network mode

1.4, 1 June 2010

  • Major reduction in database footprint in preparation for WordPress 3.0

= 1.3, 24 May 2010
* Comment counter JavaScript is now added only to those pages which would normally load a comment form

1.2.9, 20 April 2010

  • Minor code cleanups

1.2.8, 6 April 2010

  • Enhanced admin pages now support user-configurable section boxes which can be re-ordered or closed

1.2.7, 10 February 2010

  • Greatly improved spam handling: we now check the comment length after most other comment processes have had their crack at it, and we send an over-length comment to moderation queue only if no earlier process has marked it as spam

1.2.6, 12 January 2010

  • Fully tested with 2.9.1 (no changes)

1.2.5, 10 November 2009

  • Minor update to configuration pages
  • Fully tested with 2.8.5 (no changes)

1.2.4, 17 August 2009

  • Options page bugfix for users on old PHP4 installations

1.2.3, 12 August 2009

  • Documentation tweaks
  • Added support for plugin sponsorship
  • Fully tested with 2.8.4 (no changes)

1.2.2, 11 June 2009

  • Fully tested with final release of WordPress 2.8

1.2.1, 15 April 2009

  • Fixed a minor typo which would have interfered with translations for this plugin — thanks to Nikolay

1.2, 1 April 2009

  • This version brings higher performance, several minor enhancements, and a revamped administrative interface; it is recommended for all users.

1.1.1, 11 February 2009

  • Now prevents Spam Karma 2 from overriding our choice to mark over-sized comments for moderation or to treat as spam

1.1, 10 February 2009

  • As an anti-spam measure, if a user (or spambot) bypasses the JavaScript length limit, oversized comments can now be forcibly truncated, marked for moderation, marked as spam, or just passed through without modification.

1.0, 4 February 2009

  • Initial public release

Contributors & Developers

This is open source software. The following people have contributed to this plugin.

Contributors

Browse the code