Function: add_option_update_handler

add_option_update_handler( string $option_group, string $option_name, callable $sanitize_callback )

Register a setting and its sanitization callback

Shortcut: aouh

You can use above key combination to trigger the associated snippet for this function in the WordPress Snippets for Visual Studio Code extension. You can also use this shortcut to search for this function on this website.

Parameters

Name Type(s) Default Value Description
$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.

$option_name string

The name of an option to sanitize and save.

$sanitize_callback callable ''

A callback function that sanitizes the option's value.

WordPress Developer Newsletter

Stay informed of new chapter releases, important WordPress API updates and more.