register_setting WordPress Action Hook
The register_setting function is used to register a setting and its data for a particular Wordpress option. This function takes two arguments: the name of the setting and an array of arguments. The first argument (the name) is required, but the second argument is optional. The optional arguments array can contain the following keys: - type: The type of data the setting expects. This can be 'string', 'boolean', 'integer', or 'array'. The default value is 'string'. - description: A description of the data the setting expects. This will be displayed to the user when they are setting the option. -sanitize_callback: A callback function that sanitizes the data before it is saved to the database. This is useful for ensuring that only valid data is stored. -show_in_rest: Whether or not the setting should be visible in the REST API. The default value is 'false'. If you need to store multiple values for a setting, you can use the 'array' type. When using the 'array' type, you must also provide a 'sanitize_callback' function to ensure that only valid data is stored.
do_action( 'register_setting', string $option_group , string $option_name , array $args ) #
Fires immediately before the setting is registered but after its filters are in place.
Parameters
- $option_group
(string)Setting group.
- $option_name
(string)Setting name.
- $args
(array)Array of setting registration arguments.
Source
File: wp-includes/option.php
Changelog
| Version | Description |
|---|---|
| 5.5.0 | Introduced. |