add_(meta_type)_metadata хук-фильтр . WP 3.1.0
Short-circuits adding metadata of a specific type.
The dynamic portion of the hook, $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.
Использование
add_filter( 'add_(meta_type)_metadata', 'filter_function_name_9439', 10, 5 ); function filter_function_name_9439( $check, $object_id, $meta_key, $meta_value, $unique ){ // filter... return $check; }
- $check(null/true/false)
- Whether to allow adding metadata for the given type.
- $object_id(число)
- ID of the object metadata is for.
- $meta_key(строка)
- Metadata key.
- $meta_value(смешанный)
- Metadata value. Must be serializable if non-scalar.
- $unique(true/false)
- Whether the specified meta key should be unique for the object.
Список изменений
С версии 3.1.0 | Введена. |
Где вызывается хук
wp-includes/meta.php 71
$check = apply_filters( "add_{$meta_type}_metadata", null, $object_id, $meta_key, $meta_value, $unique );
Где используется хук в ядре WordPress
wp-includes/meta.php 111
add_filter( 'add_term_metadata', 'wp_check_term_meta_support_prefilter' );
wp-includes/meta.php 62
add_filter( 'add_blog_metadata', 'wp_check_site_meta_support_prefilter' );