WordPress.org

Ready to get started?Download WordPress

Codex

Function Reference/delete metadata

Contents

Description

Delete metadata for the specified object.

Calls 'delete_{$meta_type}_meta' after deleting with meta_id of deleted metadata entries, object ID, meta key, and meta value

Parameters

$meta_type
(string) (required) Type of object metadata is for (e.g., comment, post, or user)
Default: None
$object_id
(integer) (required) ID of the object metadata is for
Default: None
$meta_key
(string) (required) Metadata key
Default: None
$meta_value
(string) (optional) Optional. Metadata value. If specified, only delete metadata entries with this value. Otherwise, delete all entries with the specified meta_key.
Default:
$delete_all
(boolean) (optional) Optional, default is false. 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

Return Values

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

Change Log

Since: 2.9

Source File

delete_metadata() is located in wp-includes/meta.php

Related

Metadata API: add_metadata(), get_metadata(), update_metadata(), delete_metadata()

See also index of Function Reference and index of Template Tags.