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