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. Built from https://develop.svn.wordpress.org/trunk@46413 git-svn-id: http://core.svn.wordpress.org/trunk@46211 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -182,7 +182,7 @@ class Walker_Page extends Walker {
|
||||
|
||||
$attributes = '';
|
||||
foreach ( $atts as $attr => $value ) {
|
||||
if ( ! empty( $value ) ) {
|
||||
if ( is_scalar( $value ) && '' !== $value && false !== $value ) {
|
||||
$value = ( 'href' === $attr ) ? esc_url( $value ) : esc_attr( $value );
|
||||
$attributes .= ' ' . $attr . '="' . $value . '"';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user