delete_user_option

Delete user option with global blog capability.

Description

delete_user_option( (int) $user_id, (string) $option_name, (bool) $global = false ); 

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.

Parameters (3)

0. $user_id (int)
The user id.
1. $option_name (string)
User option name.
2. $global — Optional. (bool) => false
Whether option name is global or blog specific. Default false (blog specific).

Usage

  1. if ( !function_exists( 'delete_user_option' ) ) { 
  2. require_once ABSPATH . WPINC . '/user.php'; 
  3.  
  4. // The user id. 
  5. $user_id = -1; 
  6.  
  7. // User option name. 
  8. $option_name = ''; 
  9.  
  10. // Optional. Whether option name is global or blog specific. 
  11. // Default false (blog specific). 
  12. $global = false; 
  13.  
  14. // NOTICE! Understand what this does before running. 
  15. $result = delete_user_option($user_id, $option_name, $global); 
  16.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/user.php  
  1. function delete_user_option( $user_id, $option_name, $global = false ) { 
  2. global $wpdb; 
  3.  
  4. if ( !$global ) 
  5. $option_name = $wpdb->get_blog_prefix() . $option_name; 
  6. return delete_user_meta( $user_id, $option_name );