WordPress function to display your posts words count


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(); ?>
Advertisements