wppaste
WordPress

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

Since
5.5.0
Filters the default metadata value for a specified meta key and object.

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).

Possible filter names include:

  • default_blog_metadata
  • default_post_metadata
  • default_comment_metadata
  • default_term_metadata
  • default_user_metadata

Compatibility

WordPress
since 5.5.0
  • 6.7.7
  • 6.8.8
  • 6.9.7
  • 7.0.4
  • 7.1.0

Present in every tracked release (6.7.7 to 7.1.0).

Parameters

$valuemixed
The value to return, either a single metadata value or an array of values depending on the value of $single.
$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.

Where this hook fires · 1

  • wp-includes/meta.php:743get_metadata_default()

Source code

	 * @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.	 */	$value = apply_filters( "default_{$meta_type}_metadata", $value, $object_id, $meta_key, $single, $meta_type ); 	if ( ! $single && ! wp_is_numeric_array( $value ) ) {		$value = array( $value );	} 	return $value;

Changelog

Introduced in 5.5.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.

About this page

Parsed data
Generated from the wordpress-develop 7.1.0 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.