WordPress.org

Codex

Function Reference/update user option

Contents

Description

Update user option with global blog capability.

User options are just like user metadata except that they have support for global blog options. If the 'global' parameter is false, which it is by default, it will prepend the WordPress table prefix to the option name.

Usage

<?php update_user_option$user_id$option_name$newvalue$global ?>

Parameters

$user_id
(integer) (required) User ID
Default: None
$option_name
(string) (required) User option name.
Default: None
$newvalue
(mixed) (required) User option value.
Default: None
$global
(boolean) (optional) Whether option name is blog specific or not.
Default: false

Return Values

(boolean) 
Whether the update was successful

Examples

Notes

  • Uses global: (object) $wpdb WordPress database object for queries.

Change Log

Source File

update_user_option() is located in wp-includes/user.php.

Related

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