wp_set_all_user_settings

Advertisement

Private Access Private Access

This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

Summery Summery

Private. Sets all user interface settings.

Syntax Syntax

wp_set_all_user_settings( array $user_settings )

Parameters Parameters

$user_settings

(Required) User settings.

Return Return

(bool|null) False if the current user can't be found, null if the current user is not a super admin or a member of the site, otherwise true.

Source Source

File: wp-includes/option.php

}

/**
 * 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().
 *
 * @since 2.7.0
 *
 * @param string $names The name or array of names of the setting to be deleted.
 * @return bool|null True if deleted successfully, false otherwise.
 *                   Null if the current user is not a member of the site.
 */
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;
		}
	}

Advertisement

Changelog Changelog

Changelog
Version Description
2.8.0 Introduced.

Advertisement

Leave a Reply