From d3e0f97705bd0deafbfd778ab43cb0417638da12 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Mon, 7 Jan 2019 12:54:48 +0000 Subject: [PATCH] Taxonomy: Escape CSS classes in `Walker_Category::start_el()` after the `category_css_class` filter runs. Don't add an empty `class` attribute if there are no classes, for consistency with `Walker_Nav_Menu::start_el()`. Props abhijitrakas, mukesh27. See #44880. Built from https://develop.svn.wordpress.org/trunk@44414 git-svn-id: http://core.svn.wordpress.org/trunk@44244 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/class-walker-category.php | 3 ++- wp-includes/version.php | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/wp-includes/class-walker-category.php b/wp-includes/class-walker-category.php index 6df6431b6b..7b13264b95 100644 --- a/wp-includes/class-walker-category.php +++ b/wp-includes/class-walker-category.php @@ -204,8 +204,9 @@ class Walker_Category extends Walker { * @param array $args An array of wp_list_categories() arguments. */ $css_classes = implode( ' ', apply_filters( 'category_css_class', $css_classes, $category, $depth, $args ) ); + $css_classes = $css_classes ? ' class="' . esc_attr( $css_classes ) . '"' : ''; - $output .= ' class="' . $css_classes . '"'; + $output .= $css_classes; $output .= ">$link\n"; } elseif ( isset( $args['separator'] ) ) { $output .= "\t$link" . $args['separator'] . "\n"; diff --git a/wp-includes/version.php b/wp-includes/version.php index 94638ed237..26589f5cd3 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.1-alpha-44413'; +$wp_version = '5.1-alpha-44414'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.