register_setting ( $option_group, $option_name, $args = array() )

  • (string) option_group A settings group name. Should correspond to an allowed option key name. Default allowed option key names include 'general', 'discussion', 'media', 'reading', 'writing', and 'options'.
  • (string) option_name The name of an option to sanitize and save.
  • (array) args { Data used to describe the setting when registered. @type string $type The type of data associated with this setting. Valid values are 'string', 'boolean', 'integer', 'number', 'array', and 'object'. @type string $description A description of the data attached to this setting. @type callable $sanitize_callback A callback function that sanitizes the option's value. @type bool|array $show_in_rest Whether data associated with this setting should be included in the REST API. When registering complex settings, this argument may optionally be an array with a 'schema' key. @type mixed $default Default value when calling `get_option()`. }
Defined at:
Change Log:
  • 3: .
  • 3: .
  • 4: .
  • 5: .


Registers a setting and its data.

Related Functions

unregister_setting, get_registered_settings, register_initial_settings, register_meta, set_user_setting

Top Google Results

User discussions

wpseek mobile