Action hook 'unregister_setting'

in WP Core File wp-includes/option.php at line 3166

View Source

unregister_setting

Action Hook
Description
Fires immediately before the setting is unregistered and after its filters have been removed.

Hook Information

File Location wp-includes/option.php View on GitHub
Hook Type Action
Line Number 3166

Hook Parameters

Type Name Description
string $option_group Setting group.
string $option_name Setting name.

Usage Examples

Basic Usage
<?php
// Hook into unregister_setting
add_action('unregister_setting', 'my_custom_function', 10, 2);

function my_custom_function($option_group, $option_name) {
    // Your custom code here
}

Source Code Context

wp-includes/option.php:3166 - How this hook is used in WordPress core
<?php
3161  		 * @since 5.5.0
3162  		 *
3163  		 * @param string $option_group Setting group.
3164  		 * @param string $option_name  Setting name.
3165  		 */
3166  		do_action( 'unregister_setting', $option_group, $option_name );
3167  
3168  		unset( $wp_registered_settings[ $option_name ] );
3169  	}
3170  }
3171  

PHP Documentation

<?php
/**
		 * Fires immediately before the setting is unregistered and after its filters have been removed.
		 *
		 * @since 5.5.0
		 *
		 * @param string $option_group Setting group.
		 * @param string $option_name  Setting name.
		 */
Quick Info
  • Hook Type: Action
  • Parameters: 2
  • File: wp-includes/option.php
Related Hooks

Related hooks will be displayed here in future updates.