added_{$meta_type}_meta
Action HookDescription
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: - `added_post_meta` - `added_comment_meta` - `added_term_meta` - `added_user_meta`Hook Information
File Location |
wp-includes/meta.php
View on GitHub
|
Hook Type | Action |
Line Number | 162 |
Hook Parameters
Type | Name | Description |
---|---|---|
int
|
$mid
|
The meta ID after successful update. |
int
|
$object_id
|
ID of the object metadata is for. |
string
|
$meta_key
|
Metadata key. |
mixed
|
$_meta_value
|
Metadata value. |
Usage Examples
Basic Usage
<?php
// Hook into added_{$meta_type}_meta
add_action('added_{$meta_type}_meta', 'my_custom_function', 10, 4);
function my_custom_function($mid, $object_id, $meta_key, $_meta_value) {
// Your custom code here
}
Source Code Context
wp-includes/meta.php:162
- How this hook is used in WordPress core
<?php
157 * @param int $mid The meta ID after successful update.
158 * @param int $object_id ID of the object metadata is for.
159 * @param string $meta_key Metadata key.
160 * @param mixed $_meta_value Metadata value.
161 */
162 do_action( "added_{$meta_type}_meta", $mid, $object_id, $meta_key, $_meta_value );
163
164 return $mid;
165 }
166
167 /**
PHP Documentation
<?php
/**
* 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:
*
* - `added_post_meta`
* - `added_comment_meta`
* - `added_term_meta`
* - `added_user_meta`
*
* @since 2.9.0
*
* @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.
*/
Quick Info
- Hook Type: Action
- Parameters: 4
- File: wp-includes/meta.php
Related Hooks
Related hooks will be displayed here in future updates.