Languages: English • Italiano • 日本語 (Add your language)
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.
<?php delete_user_meta( $user_id, $meta_key, $meta_value ) ?>
This example will delete the meta_key is 'disabled' for user id 9.
<?php $user_id = 9; delete_user_meta($user_id, 'disabled'); ?>
Using if condition
<?php if ( ! delete_user_meta($user_id, '_province') ) { echo "Ooops! Error while deleting this information!"; } ?>
Since: 3.0
delete_user_meta() is located in wp-includes/user.php
.
add_user_meta(), delete_user_meta(), get_user_meta(), update_user_meta(), get_user_option(), delete_user_option(), update_user_option(),