WordPress.org

Make WordPress Core


Ignore:
Timestamp:
01/07/2019 12:53:07 PM (13 months ago)
Author:
SergeyBiryukov
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-walker-category.php

    r44413 r44414  
    205205             */
    206206            $css_classes = implode( ' ', apply_filters( 'category_css_class', $css_classes, $category, $depth, $args ) );
    207 
    208             $output .= ' class="' . $css_classes . '"';
     207            $css_classes = $css_classes ? ' class="' . esc_attr( $css_classes ) . '"' : '';
     208
     209            $output .= $css_classes;
    209210            $output .= ">$link\n";
    210211        } elseif ( isset( $args['separator'] ) ) {
Note: See TracChangeset for help on using the changeset viewer.