delete_{$meta_type}_meta

ACTION wp-includes\meta.php (ligne 500) github
Fires immediately before deleting metadata of a specific type. The dynamic portion of the hook name, `$meta_type`, refers to the meta object type (blog, post, comment, term, user, or any other type with an associated meta table). Possible hook names include:  - `delete_blog_meta`  - `delete_post_meta`  - `delete_comment_meta`  - `delete_term_meta`  - `delete_user_meta`

Paramètres

Entrée :
$meta_ids, $object_id, $meta_key, $_meta_value
Sortie :
@param string[] $meta_ids    An array of metadata entry IDs to delete.
@param int      $object_id   ID of the object metadata is for.
@param string   $meta_key    Metadata key.
@param mixed    $_meta_value Metadata value.

Utilisation

// Ajouter une fonction au hook action 'delete_{$meta_type}_meta'
add_action('delete_{$meta_type}_meta', 'ma_fonction_personnalisee', 10, 1);

function ma_fonction_personnalisee($meta_ids, $object_id, $meta_key, $_meta_value) {
    // Votre code ici
    error_log('Hook delete_{$meta_type}_meta déclenché');
}

Actualités

Chargement des actualités...