add_option_update_handler

The timeline below displays how wordpress function add_option_update_handler has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 5.9

/**
 * Register a setting and its sanitization callback
 *
 * @since 2.7.0
 * @deprecated 3.0.0 Use register_setting()
 * @see register_setting()
 *
 * @param string   $option_group      A settings group name. Should correspond to an allowed option key name.
 *                                    Default allowed option key names include 'general', 'discussion', 'media',
 *                                    'reading', 'writing', and 'options'.
 * @param string   $option_name       The name of an option to sanitize and save.
 * @param callable $sanitize_callback Optional. A callback function that sanitizes the option's value.
 */
function add_option_update_handler($option_group, $option_name, $sanitize_callback = '')
{
    _deprecated_function(__FUNCTION__, '3.0.0', 'register_setting()');
    register_setting($option_group, $option_name, $sanitize_callback);
}

WordPress Version: 5.5

/**
 * Register a setting and its sanitization callback
 *
 * @since 2.7.0
 * @deprecated 3.0.0 Use register_setting()
 * @see register_setting()
 *
 * @param string $option_group A settings group name. Should correspond to an allowed option key name.
 *                             Default allowed option key names include 'general', 'discussion', 'media',
 *                             'reading', 'writing', 'misc', 'options', and 'privacy'.
 * @param string $option_name The name of an option to sanitize and save.
 * @param callable $sanitize_callback A callback function that sanitizes the option's value.
 */
function add_option_update_handler($option_group, $option_name, $sanitize_callback = '')
{
    _deprecated_function(__FUNCTION__, '3.0.0', 'register_setting()');
    register_setting($option_group, $option_name, $sanitize_callback);
}

WordPress Version: 5.4

/**
 * Register a setting and its sanitization callback
 *
 * @since 2.7.0
 * @deprecated 3.0.0 Use register_setting()
 * @see register_setting()
 *
 * @param string $option_group A settings group name. Should correspond to a whitelisted option key name.
 *                             Default whitelisted option key names include 'general', 'discussion', 'media',
 *                             'reading', 'writing', 'misc', 'options', and 'privacy'.
 * @param string $option_name The name of an option to sanitize and save.
 * @param callable $sanitize_callback A callback function that sanitizes the option's value.
 */
function add_option_update_handler($option_group, $option_name, $sanitize_callback = '')
{
    _deprecated_function(__FUNCTION__, '3.0.0', 'register_setting()');
    register_setting($option_group, $option_name, $sanitize_callback);
}

WordPress Version: 4.6

/**
 * Register a setting and its sanitization callback
 *
 * @since 2.7.0
 * @deprecated 3.0.0 Use register_setting()
 * @see register_setting()
 *
 * @param string $option_group A settings group name. Should correspond to a whitelisted option key name.
 * 	Default whitelisted option key names include "general," "discussion," and "reading," among others.
 * @param string $option_name The name of an option to sanitize and save.
 * @param callable $sanitize_callback A callback function that sanitizes the option's value.
 */
function add_option_update_handler($option_group, $option_name, $sanitize_callback = '')
{
    _deprecated_function(__FUNCTION__, '3.0.0', 'register_setting()');
    register_setting($option_group, $option_name, $sanitize_callback);
}

WordPress Version: 4.4

/**
 * Register a setting and its sanitization callback
 *
 * @since 2.7.0
 * @deprecated 3.0.0 Use register_setting()
 * @see register_setting()
 *
 * @param string $option_group A settings group name. Should correspond to a whitelisted option key name.
 * 	Default whitelisted option key names include "general," "discussion," and "reading," among others.
 * @param string $option_name The name of an option to sanitize and save.
 * @param callable $sanitize_callback A callback function that sanitizes the option's value.
 */
function add_option_update_handler($option_group, $option_name, $sanitize_callback = '')
{
    _deprecated_function(__FUNCTION__, '3.0', 'register_setting()');
    register_setting($option_group, $option_name, $sanitize_callback);
}

WordPress Version: 4.1

/**
 * Register a setting and its sanitization callback
 *
 * @since 2.7.0
 * @deprecated 3.0.0
 * @deprecated Use register_setting()
 * @see register_setting()
 *
 * @param string $option_group A settings group name. Should correspond to a whitelisted option key name.
 * 	Default whitelisted option key names include "general," "discussion," and "reading," among others.
 * @param string $option_name The name of an option to sanitize and save.
 * @param callable $sanitize_callback A callback function that sanitizes the option's value.
 */
function add_option_update_handler($option_group, $option_name, $sanitize_callback = '')
{
    _deprecated_function(__FUNCTION__, '3.0', 'register_setting()');
    register_setting($option_group, $option_name, $sanitize_callback);
}

WordPress Version: 3.7

/**
 * Register a setting and its sanitization callback
 *
 * @since 2.7.0
 * @deprecated 3.0.0
 * @deprecated Use register_setting()
 * @see register_setting()
 *
 * @param string $option_group A settings group name. Should correspond to a whitelisted option key name.
 * 	Default whitelisted option key names include "general," "discussion," and "reading," among others.
 * @param string $option_name The name of an option to sanitize and save.
 * @param unknown_type $sanitize_callback A callback function that sanitizes the option's value.
 * @return unknown
 */
function add_option_update_handler($option_group, $option_name, $sanitize_callback = '')
{
    _deprecated_function(__FUNCTION__, '3.0', 'register_setting()');
    return register_setting($option_group, $option_name, $sanitize_callback);
}