delete_user_meta

Home » Functions » delete_user_meta

The delete_user_meta function in WordPress is used to delete a specific meta data value associated with a user. Meta data in WordPress is additional information that can be stored and retrieved for a user, such as their profile information or custom data.

By using the delete_user_meta function, developers can remove a specific piece of meta data for a user, which allows for better organization and management of user data.

Example usage code:

$user_id = 123;
$meta_key = 'favorite_color';

// Delete the meta data value for the user with ID 123 and the meta key 'favorite_color'
delete_user_meta( $user_id, $meta_key );

In the example above, the delete_user_meta function is used to remove the meta data with the key ‘favorite_color’ for the user with ID 123. This can be useful for cleaning up user data or when users no longer need a specific piece of information stored in their profile.

Learn More on WordPress.org

WordPress snippets using the delete_user_meta function

Register an account to save your snippets or go Pro to get more features.