Add Word Count to the WordPress Post Column

Last Updated: Jun 7, 2022 | WordPress Tips

If you’ve ever wanted to see what a post’s word count is without editing a post one by one, then this article is for you. Read on to learn how to add a word count to the WordPress post column.

There are 3 main functions here in this snippet. All you need to do is copy and paste the snippet into your functions.php file. Here are what the 3 functions do:

  1. Add a word count column in the admin panel.
  2. Show the word count in the word count column in the admin panel.
  3. Get the actual post word count.

The 3 WordPress Word Count Functions

// Add WordPress Word Count Column
add_filter('manage_posts_columns', 'websitejolt_add_wordcount_column');
function websitejolt_add_wordcount_column($websitejolt_columns) {
    $websitejolt_columns['websitejolt_wordcount'] = 'Word Count';
    return $websitejolt_columns;
// Show Word Count in Admin Panel
add_action('manage_posts_custom_column',  'websitejolt_show_wordcount');
function websitejolt_show_wordcount($name) 
    global $post;
    switch ($name) 
        case 'websitejolt_wordcount':
            $websitejolt_wordcount = websitejolt_post_wordcount($post->ID);
            echo $websitejolt_wordcount;
// Get individual post word count
function websitejolt_post_wordcount($post_id) {
    $websitejolt_post_content = get_post_field( 'post_content', $post_id );
    $websitejolt_final_wordcount = str_word_count( strip_tags( strip_shortcodes($websitejolt_post_content) ) );
    return $websitejolt_final_wordcount;


These functions do work, however, they may not be accurate.

If you edit a post and click on the Details button (i in a circle), the word count displayed here will be different than what is in your word count in your post list.

Also, the post count will count custom post types, even where it doesn’t make sense to do so. For example, a saved theme library, like the Divi Library.



Related Content