Skip to main content
1 of 2
Sally CJ
  • 39.9k
  • 2
  • 26
  • 48

Actually (in response to your answer), the more proper way is, instead of calling amna_do_settings_fields(), call settings_fields() so that WordPress knows what the options/settings page is and the database option to be updated:

settings_fields( 'amna-fields-group' );                       // do this
//amna_do_settings_fields('amna-fields-group', 'theme_amna'); // not this

And as I said in the comments, your form should submit to options.php and call register_setting() in your code:

// Make sure you register your setting, e.g. with the option your_option:
add_action( 'admin_init', function () {
    register_setting( 'amna-fields-group', 'your_option' );

    add_settings_section( '<section id>', '<Title>', '<callback>', 'theme_amna' );

    add_settings_field( '<id>', '<Title>', '<callback>', 'theme_amna', '<section id>' );

    ...
} );

// Then in amna_theme_options_page(), submit the form to options.php:
// <form action="options.php" ...>

// And your fields should also use the your_option in the name, e.g.
// <input name="your_option[foo]" ...>

Also, if you haven't already done so, check this out on the Plugin developer handbook. :)

Sally CJ
  • 39.9k
  • 2
  • 26
  • 48