update_(meta_type)_metadata_cache
Short-circuits updating the metadata cache of a specific type.
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:
- update_post_metadata_cache
- update_comment_metadata_cache
- update_term_metadata_cache
- update_user_metadata_cache
Usage
add_filter( 'update_(meta_type)_metadata_cache', 'wp_kama_update_meta_type_metadata_cache_filter', 10, 2 ); /** * Function for `update_(meta_type)_metadata_cache` filter-hook. * * @param mixed $check Whether to allow updating the meta cache of the given type. * @param int[] $object_ids Array of object IDs to update the meta cache for. * * @return mixed */ function wp_kama_update_meta_type_metadata_cache_filter( $check, $object_ids ){ // filter... return $check; }
- $check(mixed)
- Whether to allow updating the meta cache of the given type.
- $object_ids(int[])
- Array of object IDs to update the meta cache for.
Changelog
Since 5.0.0 | Introduced. |
Where the hook is called
update_(meta_type)_metadata_cache
wp-includes/meta.php 1151
$check = apply_filters( "update_{$meta_type}_metadata_cache", null, $object_ids );
Where the hook is used in WordPress
wp-includes/default-filters.php 137
add_filter( 'update_term_metadata_cache', 'wp_check_term_meta_support_prefilter' );
wp-includes/ms-default-filters.php 68
add_filter( 'update_blog_metadata_cache', 'wp_check_site_meta_support_prefilter' );
wp-includes/ms-site.php 427
add_filter( 'update_blog_metadata_cache', 'wp_check_site_meta_support_prefilter' );