parent == 0) { return $thematique; } else { return get_term($thematique->parent, 'thematiques'); } } // Get automatic post used in BLOCK QUESTIONS FREQUENTES function get_automatic_post($post_type) { $automatic_query_args = array( 'post_per_page' => 1, 'post_status' => 'publish', 'post_type' => 'questions', 'thematiques' => $post_type, ); return get_posts($automatic_query_args)[0]; }