<?php
/*
Plugin Name: Prolific
Version: 1.0
Plugin URI: http://justinblanton.com/projects/prolific/
Description: Calculates the weblog-wide word count and writes it to a file each time you publish a new post.
Author: Justin Blanton
Author URI: http://justinblanton.com
*/

// add hook
add_action('publish_post''prolific');

function 
prolific()  {
    global 
$wpdb$tableposts;
    
$file "/path/to/the/file/you/want/to/use";

    
$posts $wpdb->get_results("SELECT post_content FROM $tableposts WHERE post_status = 'publish'");
    foreach (
$posts as $words) {
        
$postWords strip_tags($words->post_content);
        
$postWords explode(' '$postWords);
        
$count count($postWords) + $count;
    }    
    
    
$count number_format($count);
    
$fh fopen($file'w') or die("could not open file");
    
fwrite($fh$count) or die('could not write to file'); 
    
fclose($fh);
}