Opens in a new tab
A picture of Jeff Brigman
I CODE TODAY FOR
A BETTER TOMORROW

Glossary Term

delete_metadata()

3 tags 1 category

delete_metadata() — Deletes metadata for the specified object. For historical reasons both the meta key and the meta value are expected to be “slashed” (slashes escaped) on input.

Inputs: $meta_type (string): Type of object metadata is for. Accepts ‘blog’, ‘post’, ‘comment’, ‘term’, ‘user’, or any other object type with an associated meta table. $object_id (int): ID of the object metadata is for. Pass 0 when $delete_all is true. The value no longer selects the rows to delete, but is still passed on to the hooks fired below. $meta_key (string): 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 empty string. $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 false.

Returns bool: True on successful delete, false on failure.

Term Connections

Explore related terms connected by shared tags, shared categories, and relationship phrases. This map loads only when it comes into view.

Loading term connections…