WordPress.org

Make WordPress Core

Ticket #41488: 41488.4.diff

File 41488.4.diff, 1.4 KB (added by westonruter, 4 years ago)
  • src/wp-includes/class-wp-customize-nav-menus.php

    diff --git src/wp-includes/class-wp-customize-nav-menus.php src/wp-includes/class-wp-customize-nav-menus.php
    index fdf45e5229..13dd2e3e40 100644
    final class WP_Customize_Nav_Menus { 
    12651265         *
    12661266         * @param string $nav_menu_content The HTML content for the navigation menu.
    12671267         * @param object $args             An object containing wp_nav_menu() arguments.
    1268          * @return null
     1268         * @return string Updated HTML content.
    12691269         */
    12701270        public function filter_wp_nav_menu( $nav_menu_content, $args ) {
    12711271                if ( isset( $args->customize_preview_nav_menus_args['can_partial_refresh'] ) && $args->customize_preview_nav_menus_args['can_partial_refresh'] ) {
    12721272                        $attributes = sprintf( ' data-customize-partial-id="%s"', esc_attr( 'nav_menu_instance[' . $args->customize_preview_nav_menus_args['args_hmac'] . ']' ) );
    12731273                        $attributes .= ' data-customize-partial-type="nav_menu_instance"';
    12741274                        $attributes .= sprintf( ' data-customize-partial-placement-context="%s"', esc_attr( wp_json_encode( $args->customize_preview_nav_menus_args ) ) );
    1275                         $nav_menu_content = preg_replace( '#^(<\w+)#', '$1 ' . $attributes, $nav_menu_content, 1 );
     1275                        $nav_menu_content = preg_replace( '#^(<\w+)#', '$1 ' . str_replace( '\\', '\\\\', $attributes ), $nav_menu_content, 1 );
    12761276                }
     1277
    12771278                return $nav_menu_content;
    12781279        }
    12791280