I think the title pretty much says it all! I’m working my way through various tutorials on how to add an options page to my test plugin and am struggling to understand the Register_Settings
function.
Every tutorial I have found quotes the codex for the arguments then uses the same text in the Option_Group
and Option_Name
argument. Can someone explain it to me please?
The codex defines the function as:
$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 usingget_option( $option_name )
.$option_group
is the group name used when creating security withsettings_fields( $option_group )
.