WordPress.org

Codex

Attention Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Plugin API/Action Reference/added (meta type) meta

Description

This hook is called after a call to add_metadata succeeds.

Usage

<?php add_action( "added_{$meta_type}_meta", $function_name', 10, 4 ); ?>

where $function_name is the name of the function to be called and $meta_type is the type of metadata that was added.

Parameters

$mid
(int) (required) ID of the row being added
Default: None
$object_id
(int) (required) ID of the object the metadata applies to
Default: None
$meta_key
(string) (required) Metadata key
Default: None
$_meta_value
(mixed) (required) Metadata value. Must be serializable if non-scalar.
Default: None

Note that unlike updated_(meta_type)_meta, the first parameter is $mid rather than $meta_id.

Examples

For example, to respond to additions to user metadata:

<?php
add_action( 'added_user_meta', 'my_added_user_meta', 10, 4 );

function my_added_user_meta($mid, $object_id, $meta_key, $_meta_value) {
	//do stuff
}
?>

Change Log

  • Since: unknown

Source

added_(meta_type)_meta is located in wp-includes/meta.php.

Related

This page is marked as incomplete. You can help Codex by expanding it.