On this page
wp_protect_special_option( string $option )
Protects WordPress special option from being modified.
Description
Will die if $option is in protected list. Protected options are ‘alloptions’ and ‘notoptions’ options.
Parameters
$optionstring Required-
Option name.
Source
File: wp-includes/option.php. View all references
function wp_protect_special_option( $option ) {
if ( 'alloptions' === $option || 'notoptions' === $option ) {
wp_die(
sprintf(
/* translators: %s: Option name. */
__( '%s is a protected WP option and may not be modified' ),
esc_html( $option )
)
);
}
}
Related
Uses
| Uses | Description |
|---|---|
| __() wp-includes/l10n.php | Retrieves the translation of $text. |
| esc_html() wp-includes/formatting.php | Escaping for HTML blocks. |
| wp_die() wp-includes/functions.php | Kills WordPress execution and displays HTML page with an error message. |
Used By
| Used By | Description |
|---|---|
| update_network_option() wp-includes/option.php | Updates the value of a network option that was already added. |
| add_network_option() wp-includes/option.php | Adds a new network option. |
| update_option() wp-includes/option.php | Updates the value of an option that was already added. |
| add_option() wp-includes/option.php | Adds a new option. |
| delete_option() wp-includes/option.php | Removes option by name. Prevents removal of protected WordPress options. |
Changelog
| Version | Description |
|---|---|
| 2.2.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/wp_protect_special_option