Explained here: #46382 ([walker-nav-menu] Undefined property stdclass::$current in class-walker-nav-menu.php) – WordPress Trac
As the original poster says, the lack of an empty()
check causes a lot of PHP notices.
Read-only archive : https://petitions.classicpress.net/posts/210/add-empty-check-to-class-walker-nav-menu-php
Author : KTS915
Vote count : 2
Status : Pull Request
Comments
This can be reported as a bug on GitHub.
I haven’t seen these notices on my own sites, so I think a bit more info is needed about how to see this issue.
~ posted by James Nylen
viktor
June 24, 2022, 2:55am
#3
@timkaye this one is yours. Trac issue is still open. Should we monitor it to backport or consider fixing ourselves?
I think we should probably just create a PR.
viktor
June 24, 2022, 3:09am
#5
Yes, it’s only a simple fix. Can’t really understand why WP hasn’t implemented it.
1 Like
viktor
June 25, 2022, 3:59am
#7
I was working on submitting PR for this. It turns out CP doesn’t have this issue because $atts['aria-current'] = $item->current ? 'page' : '';
was introduced in WP 5.1. Changeset 42808 .
Should we consider backporting this since it’s related to accessibility? Changeset seems to be rather simple.
Ah, then I must have experienced this only on the WP sites I manage. But, yes, please backport this and then include the check!