How to View Word Count in WordPress Posts

WordPress is a great blogging platform, but one of the most important aspects is that you need to make sure your posts are in the right word count. There are many reasons why someone might not want to publish their post on WordPress because it’s too long or short. In this guide, we will show you how to check word count for a post on WordPress.

Use WordPress Editor

You can find the number of words in your post before publishing by using word processing software. However, if you type directly onto the WordPress’s editor which is Gutenberg, it will automatically count your words. The Gutenberg editor shows many information about the current post and number of words and characters count is among them. That info lies in the information icon from top of your post.

Click on the Information icon will open this section

Many are still using the Classic editor. Number of words are shown at the bottom of the editor.

This method allows you to view one post at a time only. If you want to view word count of multi posts, you need to use a plugin or code it yourself.

Use Plugin

There are many plugins which can count all post’ words and show them in admin area. I suggest using Sortable Word Count Reloaded plugin.

This plugin gives you the option of seeing your post/page’s word count in both list and table views. It adds an extra column to the post list in the admin area. Furthermore, it allows to sort posts by number of word.

After installing and activating the plugin, you will see word count of each post as following.

Use Code

We can use 2 hooks, manage_posts_columns and manage_posts_custom_column, to add a custom column to post list.

<?php
add_filter('manage_posts_columns', 'myplugin_words_column');
function myplugin_words_column($columns) {
    $columns['words'] = '# of Words';
    return $columns;
}

add_action('manage_posts_custom_column',  'show_wordcount');
function show_wordcount($name) 
{
    global $post;
    switch ($name) 
    {
        case 'words':
            $content = get_post_field( 'post_content', $post->ID );
            $word_count = str_word_count( strip_tags( strip_shortcodes($content) ) );            
            echo $wordcount;
    }
}

Leave a Comment

Your email address will not be published. Required fields are marked *

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close