added_(meta_type)_meta хук-событиеWP 2.9.0

Fires immediately after meta of a specific type is added.

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).

Possible hook names include:

Использование

add_action( 'added_(meta_type)_meta', 'wp_kama_added_meta_type_action', 10, 4 );

/**
 * Function for `added_(meta_type)_meta` action-hook.
 * 
 * @param int    $mid         The meta ID after successful update.
 * @param int    $object_id   ID of the object metadata is for.
 * @param string $meta_key    Metadata key.
 * @param mixed  $_meta_value Metadata value.
 *
 * @return void
 */
function wp_kama_added_meta_type_action( $mid, $object_id, $meta_key, $_meta_value ){

	// action...
}
$mid(int)
The meta ID after successful update.
$object_id(int)
ID of the object metadata is for.
$meta_key(строка)
Metadata key.
$_meta_value(разное)
Metadata value.

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

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

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

add_metadata()
added_(meta_type)_meta
wp-includes/meta.php 156
do_action( "added_{$meta_type}_meta", $mid, $object_id, $meta_key, $_meta_value );

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

wp-includes/default-filters.php 114
add_action( 'added_post_meta', 'wp_cache_set_posts_last_changed' );
wp-includes/default-filters.php 119
add_action( 'added_user_meta', 'wp_cache_set_users_last_changed' );
wp-includes/default-filters.php 127
add_action( 'added_term_meta', 'wp_cache_set_terms_last_changed' );
wp-includes/default-filters.php 140
add_action( 'added_comment_meta', 'wp_cache_set_comments_last_changed' );
wp-includes/ms-default-filters.php 58
add_action( 'added_blog_meta', 'wp_cache_set_sites_last_changed' );