From 49452cd73db71733f59900c91954249f62b96122 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Mon, 7 Jan 2019 12:55:38 +0000 Subject: [PATCH] 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. Built from https://develop.svn.wordpress.org/trunk@44415 git-svn-id: http://core.svn.wordpress.org/trunk@44245 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/class-walker-page.php | 3 ++- wp-includes/version.php | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/wp-includes/class-walker-page.php b/wp-includes/class-walker-page.php index 838abe3180..398d1c8c57 100644 --- a/wp-includes/class-walker-page.php +++ b/wp-includes/class-walker-page.php @@ -148,6 +148,7 @@ class Walker_Page extends Walker { * @param int $current_page ID of the current page. */ $css_classes = implode( ' ', apply_filters( 'page_css_class', $css_class, $page, $depth, $args, $current_page ) ); + $css_classes = $css_classes ? ' class="' . esc_attr( $css_classes ) . '"' : ''; if ( '' === $page->post_title ) { /* translators: %d: ID of a post */ @@ -186,7 +187,7 @@ class Walker_Page extends Walker { } $output .= $indent . sprintf( - '
  • %s%s%s', + '%s%s%s', $css_classes, $attributes, $args['link_before'], diff --git a/wp-includes/version.php b/wp-includes/version.php index 26589f5cd3..f68e0cb644 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.1-alpha-44414'; +$wp_version = '5.1-alpha-44415'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.