WPDev.one
Core Function
View Source on Trac ↗

metadata_exists()

metadata_exists( mixed $meta_type, mixed $object_id, mixed $meta_key )

Determines if a meta field with the given key exists for the given object ID.

Parameters 3 required

Name / Type Description
string

$meta_type Type of object metadata is for. Accepts 'post', 'comment', 'term', 'user', or any other object type with an associated meta table.

Required
$object_id
int

ID of the object metadata is for.

Required
$meta_key
string

Metadata key.

Required

Return Value

(bool)
Whether a meta field with the given key exists.

Function Information

Since Version
3.3.0
Source File
wp-includes/meta.php
Advertisement