id summary reporter owner description type status priority milestone component version severity resolution keywords cc focuses 47720 Walker_Nav_Menu filter nav_menu_link_attributes checks $atts argument via empty() and not isset(), causing confusion with legitimate values that evaluate to boolean false nevma SergeyBiryukov "In file `wp-includes/class-walker-nav-menu.php`, line `206`, class function `start_el()`, where the `nav_menu_link_attributes` filter is applied, the current code checks the supplied attributes via PHP `empty()` function. This is the current code: {{{ foreach ( $atts as $attr => $value ) { if ( ! empty( $value ) ) { $value = ( 'href' === $attr ) ? esc_url( $value ) : esc_attr( $value ); $attributes .= ' ' . $attr . '=""' . $value . '""'; } } }}} If an attribute with a legitimate value, which evaluates to something that equals to boolean false is passed, then the if clause will not be executed. However, there are many cases where such values are useful. For instance an HTML data attribute with a value of zero (0) could be passed as an attribute in the `$atts` array, but its value would then be equal to boolean false (as far as PHP `empty()` is concerned and thus the value would be erroneously ignored. I believe that this check would be better done with the PHP `isset()` function like this: {{{ foreach ( $atts as $attr => $value ) { if ( ! isset( $value ) ) { $value = ( 'href' === $attr ) ? esc_url( $value ) : esc_attr( $value ); $attributes .= ' ' . $attr . '=""' . $value . '""'; } } }}}" defect (bug) closed normal 5.3 Menus 5.2.2 normal fixed has-patch needs-testing template