WordPress.org

Make WordPress Core


Ignore:
Timestamp:
10/06/2019 03:04:18 PM (6 weeks ago)
Author:
SergeyBiryukov
Message:

Menus: In Walker_Nav_Menu, Walker_Category, and Walker_Page, properly output link attributes having a legitimate "empty" value, for example an HTML data attribute with a value of zero (0).

Props nevma, AkSDvP, greenshady, SergeyBiryukov.
Fixes #47720.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-walker-nav-menu.php

    r45537 r46413  
    204204        $attributes = '';
    205205        foreach ( $atts as $attr => $value ) {
    206             if ( ! empty( $value ) ) {
     206            if ( is_scalar( $value ) && '' !== $value && false !== $value ) {
    207207                $value       = ( 'href' === $attr ) ? esc_url( $value ) : esc_attr( $value );
    208208                $attributes .= ' ' . $attr . '="' . $value . '"';
Note: See TracChangeset for help on using the changeset viewer.