Summery Summery
Determines if a meta key is set for a given object.
Syntax Syntax
Parameters Parameters
- $meta_type
-
(Required) Type of object metadata is for. Accepts 'post', 'comment', 'term', 'user', or any other object type with an associated meta table.
- $object_id
-
(Required) ID of the object metadata is for.
- $meta_key
-
(Required) Metadata key.
Return Return
(bool) True of the key is set, false if not.
Source Source
File: wp-includes/meta.php
$check = apply_filters( "get_{$meta_type}_metadata", null, $object_id, $meta_key, $single, $meta_type ); if ( null !== $check ) { if ( $single && is_array( $check ) ) { return $check[0]; } else { return $check; } } $meta_cache = wp_cache_get( $object_id, $meta_type . '_meta' ); if ( ! $meta_cache ) { $meta_cache = update_meta_cache( $meta_type, array( $object_id ) ); if ( isset( $meta_cache[ $object_id ] ) ) { $meta_cache = $meta_cache[ $object_id ]; } else { $meta_cache = null; } } if ( ! $meta_key ) { return $meta_cache; } if ( isset( $meta_cache[ $meta_key ] ) ) { if ( $single ) { return maybe_unserialize( $meta_cache[ $meta_key ][0] ); } else { return array_map( 'maybe_unserialize', $meta_cache[ $meta_key ] );
Advertisement
Changelog Changelog
Version | Description |
---|---|
3.3.0 | Introduced. |