Summery Summery

Deletes metadata for the specified object.

Syntax Syntax

delete_metadata( string $meta_type, int $object_id, string $meta_key, mixed $meta_value = '', bool $delete_all = false )

Parameters Parameters


(string) (Required) Type of object metadata is for. Accepts 'post', 'comment', 'term', 'user', or any other object type with an associated meta table.


(int) (Required) ID of the object metadata is for.


(string) (Required) Metadata key.


(mixed) (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 value: ''


(bool) (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 value: false

Return Return

(bool) True on successful delete, false on failure.

Source Source

File: wp-includes/meta.php



Changelog Changelog

Version Description
2.9.0 Introduced.


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.