WordPress.org

Codex

Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Function Reference/unregister setting

Description

Allows clean de-registration of registered settings.

Should be used mostly in deactivation hooks (edit: Really? The Settings API is about adding settings to admin screens at runtime. It's the Options API which handles their persistence in the database. This sentence led to me try to use this function to remove my saved options, which didn't work. If someone can explain how deactivation hooks should use this function, please edit this to say. User:DrIanMcDonald)

Usage

<?php unregister_setting$option_group$option_name$sanitize_callback ); ?>

Parameters

$option_group
(string) (required) Group the option belongs to (used in register_setting).
Default: None
$option_name
(string) (required) Name of the option
Default: None
$sanitize_callback
(string) (optional) Function that fills the section with the desired content. The function should echo its output.
Default: (Empty string)

Return Values

(void) 
This function does not return a value.

Change Log

Since: 2.7.0

Source File

unregister_setting() is located in wp-includes/option.php.

Related

Settings API: register_setting(), unregister_setting(), add_settings_field(), add_settings_section(), add_settings_error(), get_settings_errors(), settings_errors()

See also index of Function Reference and index of Template Tags.