fix: preserve taxonomy subterm depth per root - #2971
Open
RabbiIslamRony wants to merge 2 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Type
What kind of change does this PR introduce?
Description
Main issue
The All Locations and All Categories list views used one shared
$this->depthvalue while rendering every top-level taxonomy term.subterms_html()reduced that property during recursion and never restored it.As a result, earlier roots consumed the configured depth. Later roots could still have
has_child = true, so the template displayed a dropdown arrow, but theirsubterm_htmlwas empty. Clicking those dropdowns only toggled a CSS class because no child<ul>had been rendered.The reported location order reproduced the problem clearly with depth
2:1.0.Fix
The remaining depth is now passed by value to each recursive call. The configured
$this->depthproperty is left unchanged, so every top-level root gets the same depth budget while deeper terms still respect the configured limit.A dependency-free regression test was added because this repository does not currently include a PHPUnit test suite.
How to reproduce and test
2.php tests/php/listing-taxonomy-subterms.php.PASS: taxonomy subterm depth is isolated per root.Any linked issues
Checklist