title: Problem with WordPress "save_post" Action
body: <p>I have developed a WordPress plugin which needs to perform additional processing when a post of a custom post type is saved.</p>
  
  <p>The most logical solution was to utilise the "save_post" action. Upon being invoked the action handler either creates or updates a database record in a custom table (depending on whether "Create Post" or "Update Post" is clicked).</p>
  
  <p>I have implemented this and it seemed to be working perfectly, but there is a minor issue which I would like to resolve. It seems that "save_post" is also triggered when loading the "Create Post" page for the first time (i.e. before any user inputs are entered and before the submit new/changes button is pressed).</p>
  
  <p>This means that the custom database table is getting filled with one blank row for each new post that is saved. It also means that there is one blank row for each time the add post page is loaded.</p>
  
  <p>Here is a simplified version of my "save_post" handler:</p>
  
  <pre><code>function do_save_post($post_id) {
      if (get_post_type($post_id) !== 'mycustomtype')
          return $post_id;
  
      if (defined('DOING_AUTOSAVE') &amp;&amp; DOING_AUTOSAVE)
          return $post_id;
  
      if (!current_user_can('edit_mycustomtype'))
          return $post_id;
  
      echo 'This happens when selecting "Add New" from admin sidebar.';
      echo 'Even though post has not been saved or updated.';
      echo 'This should only happen when button on right of editor is clicked.';
  }
  </code></pre>
  
  <p>How can I detect whether the post is actually being saved?</p>