WordPress.org

Make WordPress Core

Changeset 40658


Ignore:
Timestamp:
05/12/17 20:34:43 (6 months ago)
Author:
adamsilverstein
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/nav-menu-template.php

    r40062 r40658  
    398398        } elseif ( 'custom' == $menu_item->object && isset( $_SERVER['HTTP_HOST'] ) ) { 
    399399            $_root_relative_current = untrailingslashit( $_SERVER['REQUEST_URI'] ); 
     400 
     401            //if it is the customize page then it will strips the query var off the url before entering the comparison block. 
     402            if ( is_customize_preview() ) { 
     403                $_root_relative_current = strtok( untrailingslashit( $_SERVER['REQUEST_URI'] ), '?' ); 
     404            } 
    400405            $current_url = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_root_relative_current ); 
    401406            $raw_item_url = strpos( $menu_item->url, '#' ) ? substr( $menu_item->url, 0, strpos( $menu_item->url, '#' ) ) : $menu_item->url; 
Note: See TracChangeset for help on using the changeset viewer.