WordPress function to display your posts words count

WordPress function to display your posts words count

Simply open your functions.php file and paste this function in it:

function wcount(){

ob_start();

the_content();

$content = ob_get_clean();

return sizeof(explode(” “, $content));

}

Once done, you can call the function within the loop to get the number of words of the current post:

< ?php echo wcount(); ?>