wppaste
WordPress

apply_filters( "get_{$meta_type}_metadata", mixed $value, int $object_id, string $meta_key, bool $single, string $meta_type )

Since
3.1.0, 5.5.0
Short-circuits the return value of a meta field.

Description

The dynamic portion of the hook name, $meta_type, refers to the meta object type (blog, post, comment, term, user, or any other type with an associated meta table).Returning a non-null value will effectively short-circuit the function. Possible filter names include: <ul> <li>get_blog_metadata</li> <li>get_post_metadata</li> <li>get_comment_metadata</li> <li>get_term_metadata</li> <li>get_user_metadata</li> </ul>

Parameters

$valuemixed
The value to return, either a single metadata value or an array of values depending on the value of $single. Default null.
$object_idint
ID of the object metadata is for.
$meta_keystring
Metadata key.
$singlebool
Whether to return only the first value of the specified $meta_key.
$meta_typestring
Type of object metadata is for. Accepts 'blog', 'post', 'comment', 'term', 'user', or any other object type with an associated meta table.

Fired at · 2

  • wp-includes/meta.php:664get_metadata_raw()
  • wp-includes/meta.php:774metadata_exists()

Source

	 * @param int    $object_id ID of the object metadata is for.	 * @param string $meta_key  Metadata key.	 * @param bool   $single    Whether to return only the first value of the specified `$meta_key`.	 * @param string $meta_type Type of object metadata is for. Accepts 'blog', 'post', 'comment', 'term',	 *                          'user', or any other object type with an associated meta table.	 */	$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;		}

History

Introduced in 3.1.0. Unchanged from 6.7.7 through 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

5.5.0
Added the $meta_type parameter.from the docblock
3.1.0
Introduced.from the docblock

About this page

Parsed data
Generated from the wordpress-develop 7.0.4 tag, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.