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-page.php

    r45932 r46413  
    183183        $attributes = '';
    184184        foreach ( $atts as $attr => $value ) {
    185             if ( ! empty( $value ) ) {
     185            if ( is_scalar( $value ) && '' !== $value && false !== $value ) {
    186186                $value       = ( 'href' === $attr ) ? esc_url( $value ) : esc_attr( $value );
    187187                $attributes .= ' ' . $attr . '="' . $value . '"';
Note: See TracChangeset for help on using the changeset viewer.