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
This commit is contained in:
Sergey Biryukov 2019-01-07 12:54:48 +00:00
parent a94d70b811
commit d3e0f97705
2 changed files with 3 additions and 2 deletions

View File

@ -204,8 +204,9 @@ class Walker_Category extends Walker {
* @param array $args An array of wp_list_categories() arguments. * @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 = 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"; $output .= ">$link\n";
} elseif ( isset( $args['separator'] ) ) { } elseif ( isset( $args['separator'] ) ) {
$output .= "\t$link" . $args['separator'] . "\n"; $output .= "\t$link" . $args['separator'] . "\n";

View File

@ -13,7 +13,7 @@
* *
* @global string $wp_version * @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. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.