Function: delete_user_meta

delete_user_meta( integer $user_id, string $meta_key, mixed $meta_value )

Remove metadata matching criteria from a user.

You can match based on the key, or key and value. Removing based on key and value, will keep from removing duplicate metadata with the same key. It also allows removing all metadata matching key, if needed.

Parameters

Name Type(s) Default Value Description
$user_id integer

User ID

$meta_key string

Metadata name.

$meta_value mixed ''

Optional. Metadata value.

Returns

boolean

True on success, false on failure.

WordPress Developer Newsletter

Stay on top of the latest WordPress API changes, developer tool updates, security alerts and more.