Steps
-
Add the PHP code to your child theme’s
functions.phpfile or the Code Snippets plugin. -
Save and activate the snippet.
-
Navigate to WordPress Admin → Posts → All Posts.
Hook Used
-
manage_posts_columns— Adds the Word Count column. -
manage_posts_custom_column— Displays the word count for each post.
Type: WordPress Admin Customization
Output: A Word Count column appears in the posts list, showing the number of words in each post’s saved content.
Why use this snippet? It helps you quickly review article length and maintain consistent content standards across your website.
function custom_add_word_count_column( $columns ) {
$columns['word_count'] = 'Word Count';
return $columns;
}
add_filter( 'manage_posts_columns', 'custom_add_word_count_column' );
function custom_display_word_count_column( $column, $post_id ) {
if ( 'word_count' !== $column ) {
return;
}
$content = get_post_field( 'post_content', $post_id );
$content = strip_shortcodes( $content );
$content = wp_strip_all_tags( $content );
echo esc_html( number_format_i18n( str_word_count( $content ) ) );
}
add_action( 'manage_posts_custom_column', 'custom_display_word_count_column', 10, 2 );
Tested on
Reported by the author on October 26, 2026. WPFolks has not verified this.
Not tested against WordPress 7.1.4. It may still work.
