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 ) ); } }