get_{$meta_type}_metadata
Filter HookDescription
Determines if a meta field with the given key exists for the given object ID.Hook Information
File Location |
wp-includes/meta.php
View on GitHub
|
Hook Type | Filter |
Line Number | 760 |
Hook Parameters
Type | Name | 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. |
int
|
$object_id
|
ID of the object metadata is for. |
string
|
$meta_key
|
Metadata key. |
Usage Examples
Basic Usage
<?php
// Hook into get_{$meta_type}_metadata
add_filter('get_{$meta_type}_metadata', 'my_custom_filter', 10, 3);
function my_custom_filter($meta_type, $object_id, $meta_key) {
// Your custom filtering logic here
return $meta_type;
}
Source Code Context
wp-includes/meta.php:760
- How this hook is used in WordPress core
<?php
755 if ( ! $object_id ) {
756 return false;
757 }
758
759 /** This filter is documented in wp-includes/meta.php */
760 $check = apply_filters( "get_{$meta_type}_metadata", null, $object_id, $meta_key, true, $meta_type );
761 if ( null !== $check ) {
762 return (bool) $check;
763 }
764
765 $meta_cache = wp_cache_get( $object_id, $meta_type . '_meta' );
PHP Documentation
<?php
/**
* Determines if a meta field with the given key exists for the given object ID.
*
* @since 3.3.0
*
* @param string $meta_type Type of object metadata is for. Accepts 'post', 'comment', 'term', 'user',
* or any other object type with an associated meta table.
* @param int $object_id ID of the object metadata is for.
* @param string $meta_key Metadata key.
* @return bool Whether a meta field with the given key exists.
*/
Quick Info
- Hook Type: Filter
- Parameters: 3
- File: wp-includes/meta.php
Related Hooks
Related hooks will be displayed here in future updates.