Difference between Option_Group and Option_Name in Register_Settings

The codex defines the function as:

register_setting( $option_group, $option_name, $option_validate_function );
  • $option_group is settings group name. Use when displaying on a settings page for example
  • $option_name is the database entry name
  • $option_validate_function is the callback for this database entry/this option.

Most codex tutorials use an array of data in one $option_name but that’s not required (just more efficient in terms of table rows). You can add multiple options with unique names under the same option group.

Usage

  • $option_name is the name you access when using get_option( $option_name ).
  • $option_group is the group name used when creating security with settings_fields( $option_group ).

Leave a Comment