get_term_metadata_by_mid filter-hookWP 5.0.0

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

This is one of the variants of the dynamic hook get_(meta_type)_metadata_by_mid

Usage

add_filter( 'get_term_metadata_by_mid', 'wp_kama_get_term_metadata_by_mid_filter', 10, 2 );

/**
 * Function for `get_term_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_term_metadata_by_mid_filter( $value, $meta_id ){

	// filter...
	return $value;
}
$value(stdClass|null)
The value to return.
$meta_id(int)
Meta ID.

Changelog

Since 5.0.0 Introduced.

Where the hook is called

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

Where the hook is used in WordPress

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