$cur =
$wpdb->
get_row( $wpdb->
prepare("SELECT * FROM
$wpdb->usermeta WHERE user_id = %d AND meta_key = %s",
$user_id,
$meta_key) );
if ( $cur &&
$cur->umeta_id
) do_action( 'delete_usermeta',
$cur->umeta_id,
$user_id,
$meta_key,
$meta_value );
if ( !
empty($meta_value) ) $wpdb->
query( $wpdb->
prepare("DELETE FROM
$wpdb->usermeta WHERE user_id = %d AND meta_key = %s AND meta_value = %s",
$user_id,
$meta_key,
$meta_value) );
else $wpdb->
query( $wpdb->
prepare("DELETE FROM
$wpdb->usermeta WHERE user_id = %d AND meta_key = %s",
$user_id,
$meta_key) );
clean_user_cache( $user_id );
wp_cache_delete( $user_id, 'user_meta'
);
if ( $cur &&
$cur->umeta_id
) do_action( 'deleted_usermeta',
$cur->umeta_id,
$user_id,
$meta_key,
$meta_value );
return true;
}/**
* Retrieve user metadata.
*
* If $user_id is not a number, then the function will fail over with a 'false'
* boolean return value. Other returned values depend on whether there is only
* one item to be returned, which be that single item type. If there is more
* than one metadata value, then it will be list of metadata values.
*
* @since 2.0.0
* @deprecated 3.0.0 Use get_user_meta()
* @see get_user_meta()
*
* @param int $user_id User ID
* @param string $meta_key Optional. Metadata key. Default empty.
* @return mixed
*/