Add multiple custom fields to the general settings page

Well the second bit of code is technically the correct way to do it. However, at the end of the add_settings_field() you can pass arguments. Please view the WordPress Add_Settings_Field function reference. This will help you in getting the best understanding of how the add_settings_field() function really works. Now, with that said, you could use … Read more

Settings API with arrays example

Short answer: your name attribute values must use the schema option_name[array_key]. So, when you use … <input name=”option_name[key1]”> <input name=”option_name[key2]”> … you get an array as option value in your validation function: array ( ‘key1’ => ‘some value’, ‘key2’ => ‘some other value’ ) PHP does that for you, this is not a WordPress feature. … Read more