Count the number of words in a WordPress post
<?php //count number of words in a post
function post_word_count($id) {
global $post
if ( !$id ) $id = $post->ID;
$content = get_post_field( 'post_content', $id );
$count = str_word_count( strip_tags( $content ) );
return $count;
}