title: Unable to save information to the database from custom sub-page at Wordpress Admin Panel
body: <p>I'm developing a theme with a custom page with several sub-pages at the admin panel.
  Weird but i got it working couple of times but the third time i couldn't make it work. 
  The sub-page that is not working is where I'm trying to give the user the possibility of choosing which post-formats he wants to be activated.<br>
  The main problem (for starters) is that, even if the setting is registered successfully to the wp_options table, the information is not being saved and I don't know why. </p>
  
  <p><a href="https://i.stack.imgur.com/L4L3W.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/L4L3W.png" alt="enter image description here"></a>   </p>
  
  <p>I'll try to shorten the code specifically to that sub-page.
  This code isn't finished, but it should be saving the data to the setting already. </p>
  
  <pre><code>      &lt;?php 
    /* 
    @package sunset theme
    ================================
          ADMIN FUNCTIONS
    ================================
    */
  
  
    function sunset_add_admin_page () {
  
       // Suset Admin Page
       add_menu_page( 'Sunset Sidebar Options', 'Sunset', 'manage_options', 'sunset', 'sunset_theme_create_page', get_template_directory_uri().'/img/sunset-icon.png', 110 );    
  
       // Sunset Admin Sub-Pages 
       add_submenu_page( 'sunset', 'Sunset Theme Options', __('Theme Options','sunsetTheme'), 'manage_options', 'sunset_support_page', 'sunset_theme_support_page' );
   // I coded two other submenu pages which I omitted for clarity sake.
  
       // Activate Custom Settings
  
    add_action('admin_init' , 'sunset_custom_settings');
  
    add_action('admin_menu', 'sunset_add_admin_page');
  
    function sunset_custom_settings() {
    register_setting( 'sunset-theme-support' , 'post_formats' , 'sunset_post_formats_callback' );
       add_settings_section( 'sunset-theme-options', 'Theme Options', 'sunset_theme_options_section', 'sunset_support_page' );
       add_settings_field('post-formats' , __('Post Formats', 'sunsetTheme') , 'sunset_post_formats', 'sunset_support_page' , 'sunset-theme-options');
  
    }
  
    ///////////////////  POST FORMATS    /////////////////////////
  
    // Post formats callback
  
    function sunset_post_formats_callback($input) {
       return $input;   
    }
  
    // Post formats Section 
  
    function sunset_theme_options_section() {
       echo '&lt;h4&gt;Activate and De-activate specific Theme Support Options&lt;/h4&gt;';
    }
  
    // Post-formats field
    function sunset_post_formats() {
    $formats = ['aside' , 'audio' , 'chat' , 'gallery' , 'image' , 'link' , 'quote' , 'status' , 'video'];
       $output = '';
       foreach ($formats as $format) {
          $output .= '&lt;label&gt;&lt;input id="' . $format . '" type="checkbox" value="1" name="post_formats[' . $format . ']"&gt;'. ucfirst($format) . '&lt;/label&gt;&lt;br&gt;';
       }
       echo $output; 
    }
  
    function sunset_theme_support_page() {
       require_once get_template_directory() . '/inc/templates/sunset_theme_support.php';
    }
  </code></pre>
  
  <p>The template sunset_theme_support_page() looks like this:</p>
  
  <pre><code>      &lt;h1&gt;Sunset Support Options&lt;/h1&gt;
    &lt;?php settings_errors();
    //  $firstName = esc_attr(get_option( 'first_name' )) ;
    ?&gt;  
    &lt;form method="post" action="options.php" class="form-formats-options"&gt;
       &lt;?php settings_fields( 'sunset-theme-support' ); ?&gt;
       &lt;?php do_settings_sections( 'sunset_support_page' ); ?&gt;
       &lt;?php submit_button() ; ?&gt;
    &lt;/form&gt;
  </code></pre>