[wp-trac] [WordPress Trac] #34839: Wrong attribution of current_page_parent for menus when on single/archive CPT
WordPress Trac
noreply at wordpress.org
Sat Jun 21 22:14:15 UTC 2025
#34839: Wrong attribution of current_page_parent for menus when on single/archive
CPT
-------------------------------------------------+-------------------------
Reporter: tabrisrp | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone:
Component: Menus | Version: 3.0
Severity: normal | Resolution:
Keywords: has-patch has-test-info needs-unit- | Focuses: ui
tests |
-------------------------------------------------+-------------------------
Changes (by SirLouen):
* keywords: has-patch needs-testing => has-patch has-test-info needs-unit-
tests
* focuses: template => ui
Comment:
== Test Report
=== Description
✅ This report validates whether the indicated patch works as expected.
Patch tested: https://github.com/WordPress/wordpress-
develop/pull/9039.diff
=== Environment
- WordPress: 6.9-alpha-60093-src
- PHP: 8.2.28
- Server: nginx/1.27.5
- Database: mysqli (Server: 8.4.5 / Client: mysqlnd 8.2.28)
- Browser: Chrome 137.0.0.0
- OS: Windows 10/11
- Theme: Twenty Sixteen 3.5
- MU Plugins: None activated
- Plugins:
* Category Posts in Custom Menu - Free 3.0 3.0.3
* Test Reports 1.2.0
=== Testing Instructions
1. I'm using `Category Posts in Custom Menu` plugin to showcase the
problem easily
2. Add some pages. For this test, I've added 4 pages
3. Add a post category
4. Add 2 posts to this newly created category
5. I'm using 2016 theme to configure menus more clearly
6. Go to menus and add the following
- First page as parent, second page as child of first
- Third page as parent, fourth page as child of third
- Add the category as child of Third.
- Enable the feature of the plugin previously installed in the category:
`Replace by posts in this category`
7. Go to the front end
8. Click on the second page
9. You will see that `current_page_ancestor` is present (check Supp
artifacts)
10. Click on any of the two posts that popped under the Third page submenu
11. 🐞 Page ancestor is not present (check Supp artifacts)
=== Expected Results
- Ancestors are respected in all scenarios
=== Actual Results
1. ✅ Issue resolved with patch (check Supp Artifacts)
=== Additional Notes
- Now I'm noticing that #32918 is essentially the same. That ticket was
before this, but given that almost a decade has passed since inception of
both ticket, and this has a better patch, I'm going to close the other one
in favour of this.
`needs-code-review`
- I have not reviewed the code, only tested the behaviour. As I commented
before, further assessment is required to evaluate if this patch should
move forward.
- As @mdgl commented maybe some Unit tests could be added in the same
place as the ones provided in #32367 (`needs-unit-tests`)
=== Supplemental Artifacts
==== Regular Nav Menu with Parent-Child Ancestors Class
[[Image(https://i.imgur.com/VGgU532.png)]]
==== Nav menu with Parent-Child within the logic of the plugin (no
ancestor)
[[Image(https://i.imgur.com/bFgj5dF.png)]]
=== Nav menu with Parent-Child with Patch (has ancestor)
[[Image(https://i.imgur.com/I6MC4Qr.png)]]
--
Ticket URL: <https://core.trac.wordpress.org/ticket/34839#comment:8>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list