Just count the spaces and add 1: // No need to count markup. $text = trim( strip_tags( get_the_content() ) ); $word_number = substr_count( $text, ' ' ) + 1; Another way, taking the old American double space tradition into account: $word_number = preg_match_all( '~\s+~', $text, $m ) + 1;