By default WordPress count words in the text area when you write posts, but there are no options to display this in the post meta data. With this code snippet, you can show the number of words in your post’s metadata as well.

Add this code to your functions.php file:

function myfunction_word_count() {
   return sprintf(
      __( '%s words', 'text-domain' ),
      str_word_count( strip_tags( get_post_field( 'post_content', get_the_ID() ) ) )

Then add this anywhere you like within the loop in your post or page files (e.g. single.php):

<?php echo myfunction_word_count(); ?>