title: Wordpress Custom Post Type Variable Overlap?
body: <p>So, I have two different custom post types.  Both of these have a number of multi-select boxes.  The first one, I was able to get the data in these boxes to save to the post without issue.</p>
  
  <p>The second one, however, wasn't working.  One of the 4 boxes had its data saved, and other form elements were saving, but the three other boxes weren't saving.  After staring at the code, comparing the two back and forth, and trying numerous commenting and removing, I eventually, out of desperation, renamed the custom variable names that the data was being saved to.  Lo and behold, it worked.</p>
  
  <p>So, my question is -- why?  Is there some variable overlap happening that I wasn't expecting, where it wasn't letting me save in the second CPT because the first was using the same variable name?  I have noticed (via print_r calls) that my CPTs all contain ALL of the fields I've saved in any of them.  Which seems a little odd to me, but I haven't dug into the specifics of how the data is stored, just trying to get the data out.</p>
  
  <p>Originally Working File:</p>
  
  <pre><code>function save_championship(){
      global $post;
  
      update_post_meta($post-&gt;ID, "federations", $_POST["championship_federation"]);
      update_post_meta($post-&gt;ID, "weightclasses", $_POST["championship_weightclass"]);
      update_post_meta($post-&gt;ID, "genders", $_POST["championship_gender"]);
      update_post_meta($post-&gt;ID, "type", $_POST["championship_type"]);
  }
  </code></pre>
  
  <p>And the new, (now working) second file:</p>
  
  <pre><code>function save_roster(){
          global $post;
          update_post_meta($post-&gt;ID, "team", $_POST["roster_team"]);
  
          update_post_meta($post-&gt;ID, "fedfilter", $_POST["roster_federation"]);
          update_post_meta($post-&gt;ID, "wcfilter", $_POST["roster_weightclass"]);
          update_post_meta($post-&gt;ID, "genderfilter", $_POST["roster_gender"]);
          update_post_meta($post-&gt;ID, "alignfilter", $_POST["roster_alignment"]);
  
          $fedtf = $_POST['showfed'] ? true : false;
          update_post_meta($post-&gt;ID, "showfed", $fedtf);
  
          $wctf = $_POST['showwc'] ? true : false;
          update_post_meta($post-&gt;ID, "showwc", $wctf);
  
          $gendertf = $_POST['showgender'] ? true : false;
          update_post_meta($post-&gt;ID, "showgender", $gendertf);
  
          $aligntf = $_POST['showalign'] ? true : false;
          update_post_meta($post-&gt;ID, "showalign", $aligntf);
      }
  </code></pre>
  
  <p>Originally, the second parameter of the *filter updates were "federations", "weightclasses", "genders", and "alignments".  Those did not work.  The filters do.</p>
  
  <p>Help me understand?</p>
  
  <p>EDIT: I have recently discovered the wordpress debug mode, and I've gotten some additional information on this.</p>
  
  <p>Apparently, when I save one of my custom posts, it passes through all of my custom post pages (thus giving me a whole bunch of 'undefined index' errors on save).   It finishes up with a 'cannot modify header information' for a different custom post type than the one I'm trying to save.</p>
  
  <p>It seems likely that I'm doing something wrong here.  Is there something common that I might be doing?  I don't really feel like copying every file here would be beneficial, but if this is a common side effect of what I am doing, can anyone point it out?</p>
  
  <p>Thanks.</p>