Why limit comment length in WordPress?
In our experience of moderating online discussions for the past decade, we have found that most helpful comments are above 60 characters and below 5000 characters in length.
When a person writes a one-word comment, it usually is not very helpful. In most cases, it is spam because the author is simply trying to earn a backlink from your site.
However when a person writes a comment above 5000 characters, its usually a rant / complaint that in most cases is not relevant to that particular article.
By setting comment length limits in WordPress, you can improve the quality of your comments.
There are two methods to limit comment length in WordPress. The first method requires you to install a plugin. The second method uses a simple code snippet that you can add to your site.
Method 1: Limiting Comment Lenght Using a Plugin
First thing you need to do is install and activate Control Comment Length plugin. Upon activation, simply go to Settings » Control Comment Length to configure the plugin settings.
The plugin’s user interface is in German with English. You can set both minimum and maximum number of characters a comment can have. We recommend using 60 for minimum and 5000 for maximum character count.
You can also add messages that will be visible to users when there comments are either too short or too long. The plugin only provides these messages in the German language. You can replace it with your own message.
Method 2: Limit Comment Length Using Code Snippet
The second method is for users who don’t mind dealing with code code. We will add a filter hook to preprocess_comment. This filter is run before WordPress saves any comments to database or runs any other pre-processing on submitted comments. We will use it to check the comment length. If it is above or below the set comment length parameters, then we will show users an error message.
Simply add this code to your theme’s functions.php file or a site-specific plugin.
Tables can't be imported directly. Please insert an image of your table which can be found here.
1 2 3 4 5 6 7 8 9 10 11
We hope this article helped you limit comment length in WordPress.