add_option_update_handler

Register a setting and its sanitization callback.

Description

add_option_update_handler( (string) $option_group, (string) $option_name, (string) $sanitize_callback = '' ); 

Parameters (3)

0. $option_group (string)
A settings group name. Should correspond to a whitelisted option key name. Default whitelisted option key names include general, "discussion," and reading, among others.
1. $option_name (string)
The name of an option to sanitize and save.
2. $sanitize_callback — Optional. (string) => ''
A callback function that sanitizes the option's value.

Usage

  1. if ( !function_exists( 'add_option_update_handler' ) ) { 
  2. require_once ABSPATH . '/wp-admin/includes/deprecated.php'; 
  3.  
  4. // A settings group name. Should correspond to a whitelisted option key name. 
  5. // Default whitelisted option key names include "general," "discussion," and "reading," among others. 
  6. $option_group = ''; 
  7.  
  8. // The name of an option to sanitize and save. 
  9. $option_name = ''; 
  10.  
  11. // A callback function that sanitizes the option's value. 
  12. $sanitize_callback = ''; 
  13.  
  14. // NOTICE! Understand what this does before running. 
  15. $result = add_option_update_handler($option_group, $option_name, $sanitize_callback); 
  16.  

Defined (1)

The function is defined in the following location(s).

/wp-admin/includes/deprecated.php  
  1. function add_option_update_handler( $option_group, $option_name, $sanitize_callback = '' ) { 
  2. _deprecated_function( __FUNCTION__, '3.0.0', 'register_setting()' ); 
  3. register_setting( $option_group, $option_name, $sanitize_callback );