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.

git-svn-id: https://develop.svn.wordpress.org/trunk@44414 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2019-01-07 12:53:07 +00:00
parent d6b53ec840
commit d81408d7f6

View File

@ -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";