Looking for a way to set a minimum word count in wordpress posts? Here in this article, we will help you to set a minimum word limit for your WordPress website posts.
Setting up a minimum word limit is very important for any multi-author website to maintain standards. When you set up a minimum word limit no author of your website will be able to publish a post without fulfilling the word limit, it will ensure a standard of your website posts.
Importance of setting a minimum word limit for WordPress posts
It is very important for a website to produce standard and quality content. Content word length is one of the standards levels you can set. You can block your author to publish less word content to ensure the quality of your articles.
On the other hand, there are many advantages you can get from longer content. It provides detailed information and longer content is also SEO friendly. It helps you to get a higher rank on Google Search Console. SEO-friendly content helps you to get more traffic.
Set a minimum word count in wordpress posts
The easiest and quickest way to set a minimum word count is to use a WordPress plugin. Here in this article, we will PublishPress Checklists plugin which ensures your posts have a minimum or a maximum number of words. There is a pro and free version of this plugin available. But we are using the free version as it has the word limit features.
Install and activate the plugin and then go to the Checklists page. Here you will find different options, look for the Number of Words in Content option. From the dropdown menu, you will see three options –
- Disabled – No minimum or maximum word limit
- Recommended – You can show the recommended word for your content, the author can still publish the content if it doesn’t meet the recommended word limit.
- Required – For the required option it is mandatory to fulfill the minimum or maximum word limit.
You should select the required option, after that you can select the user role where this required word limit won’t allow. After that, you need to add the minimum and maximum word limit for your posts.
When you are done click on the Save Changes button and create a post to see how the minimum or maximum word limit works.
When your post does not meet the word requirements, it will show a warning icon to your Publish button. It will also show you a message from the checklist to fulfill the word limit.
Set minimum word count manually
If you don’t want to use a plugin then you can add some code to your function.php file. But make sure don’t do anything wrong, any wrong changes in this file can break your website. If you don’t have any proper knowledge then you should not go for this process.
To add the code in your function.php file you can use an FTP client or use the code snippets plugin. See this tutorial to learn how the code snippets plugin works.
Now add the following code to your function.php file.
$content = $post->post_content;
if (str_word_count($content) < 100 ) //set this to the minimum number of words
wp_die( __('Error: your post is below the minimum word count. It needs to be longer than 100 words.') );
This code will set a minimum word limit for your WordPress posts.
Following the process, we will be able to set a minimum word count for WordPress posts. You can see our other articles to learn Web development trends in 2022.