Add `empty` check to `class-walker-nav-menu.php`

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: Issues · ClassicPress/ClassicPress · GitHub

Author: KTS915

Vote count: 2

Status: Planned (1.5.0)


Comments

@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.

Using the working patch?
https://core.trac.wordpress.org/attachment/ticket/46382/46382.diff

Yes, it’s only a simple fix. Can’t really understand why WP hasn’t implemented it.

1 Like

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!

Pull request:

1 Like

Planned for 1.5.0.

This topic was automatically closed after 3 days. New replies are no longer allowed.