From 3a830270c2ade758dac6b97cba72b87a0061eba1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rabbi=20Islam=20Rony=20=E2=9A=A1=EF=B8=8F?= <35329385+RabbiIslamRony@users.noreply.github.com> Date: Mon, 24 Aug 2026 19:52:17 +0600 Subject: [PATCH] fix: preserve taxonomy subterm depth per root --- includes/model/ListingTaxonomy.php | 14 +- tests/php/listing-taxonomy-subterms.php | 184 ++++++++++++++++++++++++ 2 files changed, 192 insertions(+), 6 deletions(-) create mode 100644 tests/php/listing-taxonomy-subterms.php diff --git a/includes/model/ListingTaxonomy.php b/includes/model/ListingTaxonomy.php index 5e6ba59167..b3f4d0b721 100644 --- a/includes/model/ListingTaxonomy.php +++ b/includes/model/ListingTaxonomy.php @@ -184,10 +184,12 @@ public function list_count_html( $term, $total ) { return $html; } - public function subterms_html( $term ) { + public function subterms_html( $term, $depth = null ) { - if ( $this->depth <= 0 ) { - return; + $depth = is_null( $depth ) ? $this->depth : $depth; + + if ( $depth <= 0 ) { + return ''; } $args = [ @@ -204,7 +206,7 @@ public function subterms_html( $term ) { if ( count( $terms ) > 0 ) { - --$this->depth; + --$depth; $html .= '