WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I get a total word count of one author's posts? I would like to be able to see what the total word count of their output is, summed across all of their posts (ideally with a breakdown by category/tag/page-or-post).

share|improve this question
up vote 4 down vote accepted

I use a plug-in called Post Word Count to sum the total number of published words across my entire site ... then again, I'm the only author, so this is a pretty simple example. But you could start with this plug-in and add a filter that changes the query based on the author's ID. Basically:

function post_word_count_by_author($author = false) {
    global $wpdb;
$now = gmdate("Y-m-d H:i:s",time());

    if ($author) $query = "SELECT post_content FROM $wpdb->posts WHERE post_author = '$author' AND post_status= 'publish' AND post_date < '$now'";
        else $query = "SELECT post_content FROM $wpdb->posts WHERE post_status = 'publish' AND post_date < '$now'";

$words = $wpdb->get_results($query);
if ($words) {
    foreach ($words as $word) {
        $post = strip_tags($word->post_content);
        $post = explode(' ', $post);
        $count = count($post);
        $totalcount = $count + $oldcount;
        $oldcount = $totalcount;
} else {
return number_format($totalcount);

This function will return a total count of all published words by that author (based on the author ID). If you don't specify an author ID, it will return a count of all published words. This won't count post revisions, drafts, or schedule posts, just those currently visible to users.

Disclaimer, I haven't tested this yet, but it's based on the original Post Word Count plug-in and should work just fine.

share|improve this answer
Adding a filter for comments/tags/etc would be simple ... just modify the query to use your custom criteria. – EAMann Aug 30 '10 at 3:47

In the interest of self-promotion, I have a plugin, WP Word Count, for word counts that might offer what you need and a bit more

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.