register_setting_args
Filter HookDescription
Filters the registration arguments when registering a setting.Hook Information
File Location |
wp-includes/option.php
View on GitHub
|
Hook Type | Filter |
Line Number | 3012 |
Hook Parameters
Type | Name | Description |
---|---|---|
array
|
$args
|
Array of setting registration arguments. |
array
|
$defaults
|
Array of default arguments. |
string
|
$option_group
|
Setting group. |
string
|
$option_name
|
Setting name. |
Usage Examples
Basic Usage
<?php
// Hook into register_setting_args
add_filter('register_setting_args', 'my_custom_filter', 10, 4);
function my_custom_filter($args, $defaults, $option_group, $option_name) {
// Your custom filtering logic here
return $args;
}
Source Code Context
wp-includes/option.php:3012
- How this hook is used in WordPress core
<?php
3007 * @param array $args Array of setting registration arguments.
3008 * @param array $defaults Array of default arguments.
3009 * @param string $option_group Setting group.
3010 * @param string $option_name Setting name.
3011 */
3012 $args = apply_filters( 'register_setting_args', $args, $defaults, $option_group, $option_name );
3013
3014 $args = wp_parse_args( $args, $defaults );
3015
3016 // Require an item schema when registering settings with an array type.
3017 if ( false !== $args['show_in_rest'] && 'array' === $args['type'] && ( ! is_array( $args['show_in_rest'] ) || ! isset( $args['show_in_rest']['schema']['items'] ) ) ) {
PHP Documentation
<?php
/**
* Filters the registration arguments when registering a setting.
*
* @since 4.7.0
*
* @param array $args Array of setting registration arguments.
* @param array $defaults Array of default arguments.
* @param string $option_group Setting group.
* @param string $option_name Setting name.
*/
Quick Info
- Hook Type: Filter
- Parameters: 4
- File: wp-includes/option.php
Related Hooks
Related hooks will be displayed here in future updates.