#51470 closed defect (bug) (invalid)
[walker-nav-menu] Undefined property stdclass::$current in nav-menu-template.php
Reported by: | rejuancse | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 5.5 |
Component: | Menus | Keywords: | |
Focuses: | Cc: |
Description
In wp-includes/nav-menu-template.php line 190 there’s a missing empty();
function around $args->container_aria_label.
Causes PHP errors everywhere wp_nav_menu(); function occurrence:
$aria_label = ( 'nav' === $args->container && $args->container_aria_label ) ? ' aria-label="' . esc_attr( $args->container_aria_label ) . '"' : '';
Should be:
$aria_label = ( 'nav' === $args->container && !empty($args->container_aria_label) ) ? ' aria-label="' . esc_attr( $args->container_aria_label ) . '"' : '';
Attachments (1)
Change History (6)
#2
@
4 years ago
I wasn't able to reproduce this.
Can you provide the exact PHP notice that you are getting as well as the steps to reproduce? Also, the title of this ticket does not seem related to the actual problem you are describing. Can you please confirm the problem you are seeing?
#3
@
4 years ago
Hello @metalandcoffee,
Does not show any additional notices in PHP.
Please see this link https://prnt.sc/vd4p4q
Fresh install in WordPress menu shows this Error. Maybe it's not a big issue, but if you use this condition then you get rid of this issue.
Thanks
#4
@
4 years ago
- Milestone Awaiting Review deleted
- Resolution set to invalid
- Status changed from new to closed
- Version changed from trunk to 5.5
Hello - I take it this is coming from this forum post: https://wordpress.org/support/topic/undefined-property-stdclasscontainer_aria_label/
Your plugin needs to either set container_aria_label
in the nav menu args in the filter you are using (appears to be overrite_functions_wp_megamenu()
), or you need to judiciously only set the arguments you actually need instead of overwriting the entire array before returning.
Create Patch