Uses
Uses | Description |
---|---|
wp-includes/option.php: get_all_user_settings() | Retrieves all user interface settings. |
wp-includes/option.php: wp_set_all_user_settings() | Private. Sets all user interface settings. |
Deletes user interface settings.
Deleting settings would reset them to the defaults.
This function has to be used before any output has started as it calls setcookie().
(string) (Required) The name or array of names of the setting to be deleted.
(bool|null) True if deleted successfully, false otherwise. Null if the current user is not a member of the site.
File: wp-includes/option.php
function delete_user_setting( $names ) { if ( headers_sent() ) { return false; } $all_user_settings = get_all_user_settings(); $names = (array) $names; $deleted = false; foreach ( $names as $name ) { if ( isset( $all_user_settings[ $name ] ) ) { unset( $all_user_settings[ $name ] ); $deleted = true; } } if ( $deleted ) { return wp_set_all_user_settings( $all_user_settings ); } return false; }
Version | Description |
---|---|
2.7.0 | Introduced. |
© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/delete_user_setting