WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru Самая быстрая Тема-конструктор для WordPress
функция не описана

delete_user_setting() WP 2.7.0

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().

Хуков нет.

Возвращает

true/false/null. True if deleted successfully, false otherwise. Null if the current user is not a member of the site.

Использование

delete_user_setting( $names );
$names(строка) (обязательный)
The name or array of names of the setting to be deleted.

Список изменений

С версии 2.7.0 Введена.

Код delete_user_setting() WP 5.5.1

<?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;
}