From 66829408d46eac712d003676e1765bdd4d78d28d Mon Sep 17 00:00:00 2001 From: PranavAwasthi Date: Wed, 26 Jun 2024 15:42:26 +0530 Subject: [PATCH] Fixed category's parent issue --- php/classes/class-qsm-questions.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/php/classes/class-qsm-questions.php b/php/classes/class-qsm-questions.php index cd7d7888c..8d54db908 100644 --- a/php/classes/class-qsm-questions.php +++ b/php/classes/class-qsm-questions.php @@ -487,7 +487,7 @@ public static function get_question_categories_from_term_ids( $term_ids ) { $categories_names[ $tax->term_id ] = $tax->name; $taxs[ $tax->parent ][] = $tax; } - $categories_tree = self::create_terms_tree( $taxs, $taxs[0] ); + $categories_tree = self::create_terms_tree( $taxs, isset( $taxs[0] ) ? $taxs[0] : reset( $taxs ) ); } $categories = array( 'list' => $categories_names, @@ -527,7 +527,7 @@ public static function get_question_categories( $question_id = 0 ) { $categories_names[ $tax->term_id ] = $tax->name; $taxs[ $tax->parent ][] = $tax; } - $categories_tree = self::create_terms_tree( $taxs, $taxs[0] ); + $categories_tree = self::create_terms_tree( $taxs, isset( $taxs[0] ) ? $taxs[0] : reset( $taxs ) ); } }