title: $post_id or $post->ID in wordpress meta box construction
body: <p>Can someone explain why when creating meta boxes the callback needs the post id to be passed via $post->ID, however with the action hook 'save_post', the function can pass $post_id.  A general explanation of when to use which one would help clear up some issues I've been having, thanks.</p>
  
  <p>ex:</p>
  
  <pre><code>function show_custom_meta_box($post) {
      $meta = get_post_meta($post-&gt;ID, 'custom_meta_class', true); 
  // Use nonce for verification
  echo '&lt;input type="hidden" name="custom_meta_box_nonce" value="'.wp_create_nonce(basename(__FILE__)).'" /&gt;';
  
      // Begin the field table and loop
      echo '&lt;table class="form-table"&gt;';
  
          echo '&lt;tr&gt;
                  &lt;th&gt;&lt;label for="custom-meta-class"&gt;Custom Meta Box&lt;/label&gt;&lt;/th&gt;
                  &lt;td&gt;
                  &lt;input class="widefat" type="text" name="custom-meta-class" id="custom-meta-class" value="'.$meta.'" size="50" /&gt;';
  
          echo '&lt;/td&gt;&lt;/tr&gt;';
  
      echo '&lt;/table&gt;'; // end table
  }
  </code></pre>
  
  <p>and for the $post_id</p>
  
  <pre><code>function save_custom_meta($post) {
  
      if( defined( 'DOING_AUTOSAVE' ) &amp;&amp; DOING_AUTOSAVE ) return;
      /* Verify the nonce before proceeding. */
      if ( !isset( $_POST['custom_meta_box_nonce'] ) || !wp_verify_nonce( $_POST['custom_meta_box_nonce'], basename( __FILE__ ) ) )
          return $post_id;
      $post_type = get_post_type_object( $post-&gt;post_type );
      /* Check if the current user has permission to edit the post. */
      if ( !current_user_can( $post_type-&gt;cap-&gt;edit_post, $post_id ) )
          return $post_id;
      /* Get the posted data and sanitize it for use as an HTML class. */
      $new_meta_value = ( isset( $_POST['custom-meta-class'] ) ? sanitize_html_class( $_POST['custom-meta-class'] ) : '' );
      /* Get the meta key. */
      $meta_key = 'custom_meta_class';
      /* Get the meta value of the custom field key. */
      $meta_value = get_post_meta( $post_id, $meta_key, true );
  
      if ( $new_meta_value &amp;&amp; '' == $meta_value )
          add_post_meta( $post_id, $meta_key, $new_meta_value, true );
  
      /* If the new meta value does not match the old value, update it. */
      elseif ( $new_meta_value &amp;&amp; $new_meta_value != $meta_value )
          update_post_meta( $post_id, $meta_key, $new_meta_value );
  
      /* If there is no new meta value but an old value exists, delete it. */
      elseif ( '' == $new_meta_value &amp;&amp; $meta_value )
          delete_post_meta( $post_id, $meta_key, $meta_value );
  }
  </code></pre>