delete_option
Action HookDescription
Fires immediately before an option is deleted.Hook Information
| File Location | 
                                wp-includes/option.php
                                
                                    View on GitHub
                                
                             | 
                        
| Hook Type | Action | 
| Line Number | 1228 | 
                        
Hook Parameters
| Type | Name | Description | 
|---|---|---|
                                    string
                                 | 
                                
                                    $option
                                 | 
                                Name of the option to delete. | 
Usage Examples
                        Basic Usage
                    
                    <?php
// Hook into delete_option
add_action('delete_option', 'my_custom_function', 10, 1);
function my_custom_function($option) {
    // Your custom code here
}
                        
                    Source Code Context
                        wp-includes/option.php:1228
                        - How this hook is used in WordPress core
                    
                    <?php
1223  	 *
1224  	 * @since 2.9.0
1225  	 *
1226  	 * @param string $option Name of the option to delete.
1227  	 */
1228  	do_action( 'delete_option', $option );
1229  
1230  	$result = $wpdb->delete( $wpdb->options, array( 'option_name' => $option ) );
1231  
1232  	if ( ! wp_installing() ) {
1233  		if ( in_array( $row->autoload, wp_autoload_values_to_autoload(), true ) ) {
                    PHP Documentation
<?php
/**
	 * Fires immediately before an option is deleted.
	 *
	 * @since 2.9.0
	 *
	 * @param string $option Name of the option to delete.
	 */
                
            
                        Quick Info
                    
                    - Hook Type: Action
 - Parameters: 1
 - File: wp-includes/option.php
 
                        Related Hooks
                    
                    Related hooks will be displayed here in future updates.