WordPress, an open-source Content Management System (CMS) based on PHP and MySQL, is widely used for creating dynamic websites. If you run a WordPress blog with multiple authors contributing content, having word count statistics in your dashboard is essential. It helps you evaluate content length and ensures it meets the required word limits.
After installing and activating the plugin, the word count will be displayed in the "Post" section of the Dashboard for each post.
Method 1: Using a WordPress Plugin
Step 1: Install and Activate a Plugin
First login to your WordPress dashboard using the user login ID and password.

Step 2: After login into your WordPress dashboard, now hover over the "Plugins" section and then click on the "Add New" button to add the plugin.

Step 3: Now search for "Word Count Analysis" in the search box and then click on the "Install Now" button to install the plugin on your WordPress website.

Step 4: After installing the plugin, click on the "Activate" button to activate the plugin on your WordPress website.

Step 5: After activating the plugin, now choose the language, we are choosing the English language and then clicking on the "Count and analyze words" button.

Step 6: Now it will start showing the word count in front of the posts.

This is how you add the word count stats to your WordPress website using the plugin.
Now let us see how we can add the word count stats using the code.
2. Adding word count using the custom code
- This method is for experts who have some coding knowledge in the PHP programming language.
- You have to add the code to the "functions.php" file on your WordPress website.
- The "functions.php" file is found in the theme folder. You can find the "functions.php" file in the path of "wp-content/themes/your-theme/functions.php"
- Add the code given below and it will start showing the word count stats in your WordPress dashboard.
<?php
// Display the word count in the custom column
// Add custom column to the Posts list in
// the dashboard
function word_count_column( $columns ) {
$columns['word_count'] = 'Word Count';
return $columns;
}
add_filter( 'manage_posts_columns', 'word_count_column' );
// Populate the custom column in the Posts list
function word_count_column_content( $column, $post_id ) {
if ( 'word_count' === $column ) {
$content = get_post_field( 'post_content', $post_id );
$word_count = str_word_count( strip_tags( $content ) );
echo $word_count;
}
}
add_action( 'manage_posts_custom_column',
'word_count_column_content', 10, 2 );
?>
Now it will start showing the word count on your WordPress dashboard.

This is how you add the word count using the custom code to your WordPress website.