WordPress.org

Make WordPress Core


Ignore:
Timestamp:
10/06/2019 03:04:18 PM (7 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-category.php

    r46163 r46413  
    140140        $attributes = '';
    141141        foreach ( $atts as $attr => $value ) {
    142             if ( ! empty( $value ) ) {
     142            if ( is_scalar( $value ) && '' !== $value && false !== $value ) {
    143143                $value       = ( 'href' === $attr ) ? esc_url( $value ) : esc_attr( $value );
    144144                $attributes .= ' ' . $attr . '="' . $value . '"';
Note: See TracChangeset for help on using the changeset viewer.