update_(meta_type)_metadata_by_mid
Short-circuits updating metadata of a specific type 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:
- update_post_metadata_by_mid
- update_comment_metadata_by_mid
- update_term_metadata_by_mid
- update_user_metadata_by_mid
Использование
add_filter( 'update_(meta_type)_metadata_by_mid', 'wp_kama_update_meta_type_metadata_by_mid_filter', 10, 4 ); /** * Function for `update_(meta_type)_metadata_by_mid` filter-hook. * * @param null|bool $check Whether to allow updating metadata for the given type. * @param int $meta_id Meta ID. * @param mixed $meta_value Meta value. Must be serializable if non-scalar. * @param string|false $meta_key Meta key, if provided. * * @return null|bool */ function wp_kama_update_meta_type_metadata_by_mid_filter( $check, $meta_id, $meta_value, $meta_key ){ // filter... return $check; }
- $check(null|true|false)
- Whether to allow updating metadata for the given type.
- $meta_id(int)
- Meta ID.
- $meta_value(разное)
- Meta value. Must be serializable if non-scalar.
- $meta_key(строка|false)
- Meta key, if provided.
Список изменений
С версии 5.0.0 | Введена. |
Где вызывается хук
update_(meta_type)_metadata_by_mid
wp-includes/meta.php 903
$check = apply_filters( "update_{$meta_type}_metadata_by_mid", null, $meta_id, $meta_value, $meta_key );
Где используется хук в WordPress
wp-includes/default-filters.php 141
add_filter( 'update_term_metadata_by_mid', 'wp_check_term_meta_support_prefilter' );
wp-includes/ms-default-filters.php 66
add_filter( 'update_blog_metadata_by_mid', 'wp_check_site_meta_support_prefilter' );