title: Wordpress 4.1 settings page only save one field
body: <p>I'm a bit lost right now as I'm doing the settings page for my plugin but only one field is stored to the database. I'm not sure how to track the problem down. </p>
  
  <p>Here's my code</p>
  
  <pre><code>&lt;?php
  
  // Class implementing all of the necessary steps for adding a settings page in Wordpress
  class EventsSettings {
  
      // The text that identifies settings as belonging to this plugin
      const PLUGIN_SLUG = "events";
      // The group that all of the Podio settings will belong to
      const PODIO_SETTINGS_GROUP = "events-podio-settings";
      const PODIO_SETTINGS_SECTION = "events-podio-settings-section";
  
      // The names of the settings that will be stored
      const OPT_PODIO_CLIENT_ID = "events-podio-client-id";
      const OPT_PODIO_CLIENT_SECRET = "events-podio-client-secret";
      const OPT_PODIO_APP_ID = "events-podio-app-id";
      const OPT_PODIO_APP_TOKEN = "events-podio-app-token";
  
      const FACEBOOK_SETTINGS_GROUP = "events-facebook-settings";
      const FACEBOOK_SETTINGS_SECTION = "events-facebook-settings-section";
  
      const OPT_FACEBOOK_APP_ID = "events-facebook-app-id";
  
      public function __construct() {
          // Adds hooks for functions that get called to add a menu item, render a settings page and 
          // register settings that we will store
          add_action("admin_menu", array($this, "initAdminMenu"));
          add_action("admin_init", array($this, "initSettingsOptions"));
      }
  
      // Handles adding a menu item to the Wordpress settings list
      public function initAdminMenu() {
          // Adds a menu item that will call renderOptionsPage when opened
          add_options_page("New York Events", " Events", "manage_options", self::PLUGIN_SLUG, array($this, "renderOptionsPage"));
      }
  
      // Initializes all settings that we will store
      public function initSettingsOptions() {
          // Registers all settings with the same settings group
          register_setting(self::PODIO_SETTINGS_GROUP, self::OPT_PODIO_CLIENT_ID);
          register_setting(self::PODIO_SETTINGS_GROUP, self::OPT_PODIO_CLIENT_SECRET);
          register_setting(self::PODIO_SETTINGS_GROUP, self::OPT_PODIO_APP_ID);
          register_setting(self::PODIO_SETTINGS_GROUP, self::OPT_PODIO_APP_TOKEN);
          register_setting(self::FACEBOOK_SETTINGS_GROUP, self::OPT_FACEBOOK_APP_ID);
  
          // Creates a section of settings for the UI, then adds that section to the same
          // "plugin slug" that we used for creating the options page
          add_settings_section(self::PODIO_SETTINGS_SECTION, "Podio Settings", array($this, "podioSettingsHelpText"), self::PLUGIN_SLUG);
  
          // Add the actual input fields to the settings section that we just created.
          // The third parameter of each function call will get called to render the input field for 
          // the corresponding setting value
          add_settings_field(self::OPT_PODIO_CLIENT_ID, "Podio Client ID", array($this, "field_podioClientID"), self::PLUGIN_SLUG, self::PODIO_SETTINGS_SECTION);
          add_settings_field(self::OPT_PODIO_CLIENT_SECRET, "Podio Client Secret", array($this, "field_podioClientSecret"), self::PLUGIN_SLUG, self::PODIO_SETTINGS_SECTION);
          add_settings_field(self::OPT_PODIO_APP_ID, "Podio App ID", array($this, "field_podioAppID"), self::PLUGIN_SLUG, self::PODIO_SETTINGS_SECTION);
          add_settings_field(self::OPT_PODIO_APP_TOKEN, "Podio App Token", array($this, "field_podioAppToken"), self::PLUGIN_SLUG, self::PODIO_SETTINGS_SECTION);
  
          add_settings_section(self::FACEBOOK_SETTINGS_SECTION, "Facebook Settings", array($this, "facebookSettingsHelpText"), self::PLUGIN_SLUG);
          add_settings_field(self::OPT_FACEBOOK_APP_ID, "Facebook App ID", array($this, "field_facebookAppId"), self::PLUGIN_SLUG, self::FACEBOOK_SETTINGS_SECTION);
      }
  
      // This renders the HTML of our settings page
      public function renderOptionsPage() {
          $cache = FSCache::instance();
          // Uses the EventsTemplate helper to render the "settings" view
          EventsTemplate::render("settings", array('this' =&gt; $this, 'cache' =&gt; $cache));
      }
  
      // Returns help text for the settings page
      public function podioSettingsHelpText() {
          echo "These settings are used to get events from Podio";
      }
  
      public function facebookSettingsHelpText() {
          echo "These settings are used to share events to Facebook";
      }
  
      // Called for each setting to render an input field
      public function field_podioClientID() {
          echo $this-&gt;renderInput(self::OPT_PODIO_CLIENT_ID);
      } 
      public function field_podioClientSecret() {
          echo $this-&gt;renderInput(self::OPT_PODIO_CLIENT_SECRET);        
      } 
      public function field_podioAppID() {
          echo $this-&gt;renderInput(self::OPT_PODIO_APP_ID);
      } 
      public function field_podioAppToken() {
          echo $this-&gt;renderInput(self::OPT_PODIO_APP_TOKEN);
      }
      public function field_facebookAppId() {
          echo $this-&gt;renderInput(self::OPT_FACEBOOK_APP_ID);
      }
  
      // Renders the input field for a given option name
      private function renderInput($optionName) {
          // Gets the value of the option and then returns the HTML for the input
          $setting = esc_attr(get_option($optionName));
          return "&lt;input type='text' id='$optionName' name='$optionName' value='$setting' style='width:400px;'/&gt;";
      }
  
      // Helper function for getting the value of an option
      public function get($optionName) {
          $val = get_option($optionName);
          return empty($val) ? null : $val;
      }
  }
  </code></pre>
  
  <p>And this is my template</p>
  
  <pre><code>&lt;div class="wrap"&gt;
      &lt;h2&gt;New York Events Plugin&lt;/h2&gt;
      &lt;form action="options.php" method="POST"&gt;
          &lt;?php settings_fields($this::PODIO_SETTINGS_GROUP);?&gt;
          &lt;?php settings_fields($this::FACEBOOK_SETTINGS_GROUP);?&gt;
          &lt;?php do_settings_sections($this::PLUGIN_SLUG);?&gt;
          &lt;?php submit_button();?&gt;
      &lt;/form&gt;
  
      &lt;h3&gt;Cache Settings&lt;/h3&gt;
      &lt;div&gt;
          Current Cache Size: &lt;?php echo $cache-&gt;getCacheSize()?&gt;
      &lt;/div&gt;
      &lt;div style="margin: 20px 0; width:620px;"&gt;
          If you've made changes to events in Podio and they're not showing up on the site, or if the cache is taking up too much space, you can clear the cache.
      &lt;/div&gt;
      &lt;div class="button button-primary"&gt;Clear Cache&lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>This is what renders on my settings page</p>
  
  <p><img src="https://i.stack.imgur.com/rJdA8.png" alt="enter image description here"></p>
  
  <p>As you can see, only Facebook API is stored to the database.</p>