get_(meta_type)_metadata_by_mid хук-фильтрWP 5.0.0

Short-circuits the return value when fetching a meta field by meta ID.

The dynamic portion of the hook name, $meta_type, refers to the meta object type (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 hook names include:


add_filter( 'get_(meta_type)_metadata_by_mid', 'wp_kama_get_meta_type_metadata_by_mid_filter', 10, 2 );

 * Function for `get_(meta_type)_metadata_by_mid` filter-hook.
 * @param stdClass|null $value   The value to return.
 * @param int           $meta_id Meta ID.
 * @return stdClass|null
function wp_kama_get_meta_type_metadata_by_mid_filter( $value, $meta_id ){

	// filter...
	return $value;
The value to return.
Meta ID.

Список изменений

С версии 5.0.0 Введена.

Где вызывается хук

wp-includes/meta.php 826
$check = apply_filters( "get_{$meta_type}_metadata_by_mid", null, $meta_id );

Где используется хук в WordPress

wp-includes/default-filters.php 134
add_filter( 'get_term_metadata_by_mid', 'wp_check_term_meta_support_prefilter' );
wp-includes/ms-default-filters.php 65
add_filter( 'get_blog_metadata_by_mid', 'wp_check_site_meta_support_prefilter' );