When updating this object, to prevent infinite loops, use $wpdb to update data, since wp_update_post spawns more calls to the save_post action. This ensures hooks are fired by either WP itself (admin screen save), or an update purely from CRUD.
$coupon->get_id(
Sortie :
// Ajouter une fonction au hook action 'woocommerce_update_coupon'
add_action('woocommerce_update_coupon', 'ma_fonction_personnalisee', 10, 1);
function ma_fonction_personnalisee($coupon->get_id() {
// Votre code ici
error_log('Hook woocommerce_update_coupon déclenché');
}
Chargement des actualités...