delete_metadata
delete_metadata ( $meta_type, $object_id, $meta_key, $meta_value = '', $delete_all = false )
Parameters:- (string) meta_type Type of object metadata is for. Accepts 'post', 'comment', 'term', 'user', or any other object type with an associated meta table.
- (int) object_id ID of the object metadata is for.
- (string) meta_key Metadata key.
- (mixed) meta_value Optional. Metadata value. Must be serializable if non-scalar. If specified, only delete metadata entries with this value. Otherwise, delete all entries with the specified meta_key. Pass `null`, `false`, or an empty string to skip this check. (For backward compatibility, it is not possible to pass an empty string to delete those entries with an empty string for a value.) Default empty string.
- (bool) delete_all Optional. If true, delete matching metadata entries for all objects, ignoring the specified object_id. Otherwise, only delete matching metadata entries for the specified object_id. Default false.
Returns:- (bool) True on successful delete, false on failure.
Defined at: - Introduced in WordPress: 2.9.0
- Deprecated in WordPress: —
Description
Deletes metadata for the specified object.