How to Set a Word Count for WordPress Post

How to Set a Word Count in WordPress Posts?

Why do we need to consider how much word count is there in a post before we publish? Does it help us in any way?

Yes. It will really help you. How much impact you make with the content and Google ranking will be most probably determined but quality matters as much as the length of a post and also the impact in each line to make visitors move on rather than stop in the first paragraph itself.

When you have multiple authors and posts, you cannot have an eye on counts but rather have an eye on the content and topics it covers. It also ensures the author or post meets the standard requirements or high-quality content for an article to cover the specific topic.

So, in this topic, we will help you set the minimum word count in WordPress posts to publish live.

There are two ways we can set a word count for posts.

Minimum Word Count set with a Plugin

The simplest way to set a minimum word count for your WordPress posts is by using a plugin like Publish Press Checklists. It allows you to set tasks for authors as must complete before publishing the content. Also, you can set a minimum and maximum word count on posts and pages.

Step 1 -> Login to WordPress Dashboard » Plugins » Add New

Add-new-plugin

Step 2 -> Install the Plugin “Publish Press Checklists” and activate it. Make sure you have web hosting for WordPress that supports all the plugins.

Install-Publishpress-checklist

Step 3 -> Upon activation, in the admin area, Click “Checklists”.

Checklists

Step 4 -> Now you can choose if you want to make the ‘Number of words in content’ option disabled, required, or recommended task from the dropdown menu.
Disabled – Not required
Required – Must complete this task to publish a post or show an error.
Recommended – Authors can publish posts even if they don’t meet the minimum word count.

Set-Word-Count

It also lets you exclude the user roles from meeting the word count requirement. Just click on the box under the ‘Who can ignore the task?’ column and select a user role.
Now set the minimum and maximum word count as must be met to publish the article.

Step 5 -> Click “Save Changes”, type the words in the article, and publish it. If the total count is below 350 for example, it will show the error below:

Error-Word-Count-below-350

Minimum Word Count set by editing function.php manually

As we are editing the WordPress theme files, create a child theme of the active parent theme. By using a child theme, you can apply modifications without affecting the parent theme files.
However, we don’t recommend editing the main theme files. Even a small mistake can block the website and show critical errors while trying to access the WordPress dashboard.
To make this process simple, we recommend “Code Snippet” to smooth the process. It won’t affect your site and also makes it easier to keep track of any snippets you add to your site.

Step 1 -> Install the plugin “Code Snippet” and activate it.

Step 2 -> Click Snippet » Add New » Paste the below code and Click “Save changes and Activate”.

function minWord($content)

{

    global $post;

    $content = $post->post_content;

    if (str_word_count($content) < 350 ) //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 350 words.’) );

}

add_action(‘publish_post’, ‘minWord’);

If you want to set the minimum word count as 350 for example, then change both lines of the code.

Now, if you try to publish a post below 350 words, then the following error page will show.

Error-Minimum-word-count