Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Count the total words of all posts for the year
$words = 0;
$posts = query_posts([
'posts_per_page' => -1,
'year' => '2014',
foreach ($posts as $post) {
$words += str_word_count($post->post_content);
echo 'Total Words: '. number_format($words);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment