title: WP hook function 'save_post'
body: <p>Was trying to use the save_post hook to create a html file, every time a file is saved.</p>
  
  <p>But after editing the content and on trying to update an existing post, wp returns the message </p>
  
  <blockquote>
    <p>"Not Found Apologies, but the page you requested could not be found.
    Perhaps searching will help."</p>
  </blockquote>
  
  <p>The post is neither updated in WP, nor the function 'write_single_post' creates a html file as intended. Is there anything wrong with the way the function and the hook is used.....  </p>
  
  <pre><code>function write_single_post($post_ID)  
  {
  global $folder;
  
   $file = $folder.$post_ID.".html";
  
  $fh = fopen($file, 'w') or die("can't open file");
  $string ="data goes here\n";
  echo (fwrite($fh,$string))?"written":"not writtern";
  fclose($fh);
  }
  
  do_action('save_post','write_single_post',$post_ID);
  </code></pre>