diff --git a/includes/artisans.php b/includes/artisans.php index be60582..d96fb57 100644 --- a/includes/artisans.php +++ b/includes/artisans.php @@ -398,14 +398,15 @@ function update_artisan_nl_status_on_post_save($post_id) if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) return; if (defined('DOING_AJAX') && DOING_AJAX) return; if (wp_is_post_revision($post_id)) return; + if (get_post_status($post_id) === 'auto-draft') return; + - // Récupérer la langue du post actuel $current_language = apply_filters('wpml_post_language_details', null, $post_id); - // Si c'est un post français, synchroniser avec le post néerlandais if (isset($current_language['language_code']) && $current_language['language_code'] === 'fr') { // Récupérer l'ID du post correspondant en néerlandais - $nl_post_id = apply_filters('wpml_object_id', $post_id, 'artisans', TRUE, 'nl'); + $nl_post_id = apply_filters('wpml_object_id', $post_id, 'artisans', false, 'nl'); + if (!isset($nl_post_id)) return null; wp_update_post(array( 'ID' => $nl_post_id,