Customizer: Fix an issue with menu classes in the customizer preview.

In customizer preview, strip changeset uuid in menu urls before comparing with current url to determine menu item classes.

In the customizer, menu items now contain a changeset uuid as part of their urls. Strip the changeset uuid off the url before comparing with current url (which lacks the changeset uuid).

Props priyankabehera155, jipmoors.
Fixes #39758.


Built from https://develop.svn.wordpress.org/trunk@40658


git-svn-id: http://core.svn.wordpress.org/trunk@40521 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Adam Silverstein 2017-05-12 20:35:43 +00:00
parent cb2eac9e06
commit 8b60430aee
2 changed files with 6 additions and 1 deletions

View File

@ -397,6 +397,11 @@ function _wp_menu_item_classes_by_context( &$menu_items ) {
// if the menu item corresponds to the currently-requested URL
} elseif ( 'custom' == $menu_item->object && isset( $_SERVER['HTTP_HOST'] ) ) {
$_root_relative_current = untrailingslashit( $_SERVER['REQUEST_URI'] );
//if it is the customize page then it will strips the query var off the url before entering the comparison block.
if ( is_customize_preview() ) {
$_root_relative_current = strtok( untrailingslashit( $_SERVER['REQUEST_URI'] ), '?' );
}
$current_url = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_root_relative_current );
$raw_item_url = strpos( $menu_item->url, '#' ) ? substr( $menu_item->url, 0, strpos( $menu_item->url, '#' ) ) : $menu_item->url;
$item_url = set_url_scheme( untrailingslashit( $raw_item_url ) );

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.8-alpha-40657';
$wp_version = '4.8-alpha-40658';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.