Make WordPress Core

Changeset 44415


Ignore:
Timestamp:
01/07/2019 12:53:22 PM (6 years ago)
Author:
SergeyBiryukov
Message:

Pages, Post Types: Escape CSS classes in Walker_Page::start_el() after the page_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.
Fixes #44880.

File:
1 edited

Legend:

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

    r42875 r44415  
    149149         */
    150150        $css_classes = implode( ' ', apply_filters( 'page_css_class', $css_class, $page, $depth, $args, $current_page ) );
     151        $css_classes = $css_classes ? ' class="' . esc_attr( $css_classes ) . '"' : '';
    151152
    152153        if ( '' === $page->post_title ) {
     
    187188
    188189        $output .= $indent . sprintf(
    189             '<li class="%s"><a%s>%s%s%s</a>',
     190            '<li%s><a%s>%s%s%s</a>',
    190191            $css_classes,
    191192            $attributes,
Note: See TracChangeset for help on using the changeset viewer.