post_type === 'conseils') { $currentThematique = get_the_terms($post->ID, 'thematiques') ? get_the_terms($post->ID, 'thematiques')[0] : null; $mainThematique = getMainThematique($currentThematique) ?? null; if (!$mainThematique) return; $mainThematiqueFr = apply_filters('wpml_object_id', $mainThematique->term_id, 'thematiques', TRUE, 'fr'); $thematique_picture = get_field('taxonomy_pictures', "thematiques_" . $mainThematiqueFr)['illustration_s'] ?? null; if (!$thematique_picture) return; add_post_meta($post->ID, '_thumbnail_id', $thematique_picture['ID']); }; if ($post->post_type === 'page') { write_log("un page mon ami"); }; }