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