add_<meta_type>_meta
Fires immediately before meta of a specific type is added.
Description
The dynamic portion(s) of the hook refer to the meta object type (comment, post, or user).
Parameters (3)
- 0. $object_id (int)
- The object id.
- 1. $meta_key (string)
- The meta key.
- 2. $meta_value (mixed)
- The meta value.
Usage
- To run the hook, copy the example below.
- // run the action
- do_action( 'add_{$meta_type}_meta', $object_id, $meta_key, $meta_value );
- The following example is for adding a hook callback.
- // define the add_<meta_type>_meta callback
- function action_add_meta_type_meta( $object_id, $meta_key, $meta_value ) {
- // make action magic happen here...
- };
- // add the action
- add_action( "add_{$meta_type}_meta", 'action_add_meta_type_meta', 10, 3 );
- To remove a hook callback, use the example below.
- // remove the action
- remove_action( "add_{$meta_type}_meta", 'action_add_meta_type_meta', 10, 3 );
Defined (1)
The action is defined in the following location(s).
- /wp-includes/meta.php
- do_action( "add_{$meta_type}_meta", $object_id, $meta_key, $_meta_value );