delete_metadata

Advertisement

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

$meta_type

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

$object_id

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

$meta_key

(string) (Required) Metadata key.

$meta_value

(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: ''

$delete_all

(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


			

Advertisement

Changelog Changelog

Changelog
Version Description
2.9.0 Introduced.

Advertisement

Leave a Reply

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