Skip to content

Instantly share code, notes, and snippets.

@danemorgan
Last active December 23, 2015 01:09
Show Gist options
  • Save danemorgan/6558978 to your computer and use it in GitHub Desktop.
Save danemorgan/6558978 to your computer and use it in GitHub Desktop.
Get the word count for your Wordpress Posts
function post_wordcount($postid) {
$content = get_post($postid);
$completContent = $content->post_content;
$wordsCount = count(explode(" ", $completContent));
return $wordsCount;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment