WordPress.org

Ready to get started?Download WordPress

Codex

Function Reference/delete usermeta

← Return to function reference.


This function has been deprecated. That means it has been replaced by a new function or is no longer supported, and may be removed from future versions. All code that uses this function should be converted to use its replacement if one exists. See also wp-includes/deprecated.php. Use any of these functions instead.

Contents

Description

This function is deprecated as of Version 3.0. Please use delete_user_meta instead.

Removes a user meta record from the wp_usermeta database table for a specific user ID.

Usage

 <?php delete_usermeta$user_id$meta_key$meta_value ); ?> 

Parameters

$user_id
(integer) (required) The ID of the WordPress user
Default: None
$meta_key
(string) (required) The meta_key field value
Default: None
$meta_value
(string) (optional) The meta_value field value; if omitted, the key is deleted regardless of value
Default: None

Return Values

(bool) 
  • True if deletion completed.
  • False if user_id is not a number.

Example

<?php if (delete_usermeta(7'first_name')) {
    echo 
'User meta key successfully removed!';
} else {
    echo 
'User meta record could not be removed!';
?> 

Change Log

Since: 2.0.0

Source File

Related