mirror of
https://github.com/WordPress/WordPress.git
synced 2025-02-02 05:31:25 +01:00
When doing current page highlighting logic, apply untrailingslashit() to everything so that slash additions or omissions still match. fixes #14208. props filosofo
git-svn-id: http://svn.automattic.com/wordpress/trunk@15584 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
437a0f5cbb
commit
e7c4ac4014
@ -359,9 +359,9 @@ function _wp_menu_item_classes_by_context( &$menu_items ) {
|
|||||||
|
|
||||||
// if the menu item corresponds to the currently-requested URL
|
// if the menu item corresponds to the currently-requested URL
|
||||||
} elseif ( 'custom' == $menu_item->object ) {
|
} elseif ( 'custom' == $menu_item->object ) {
|
||||||
$current_url = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
|
$current_url = untrailingslashit( ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
|
||||||
$item_url = strpos( $menu_item->url, '#' ) ? substr( $menu_item->url, 0, strpos( $menu_item->url, '#' ) ) : $menu_item->url;
|
$item_url = untrailingslashit( strpos( $menu_item->url, '#' ) ? substr( $menu_item->url, 0, strpos( $menu_item->url, '#' ) ) : $menu_item->url );
|
||||||
$_indexless_current = preg_replace( '/index.php$/', '', $current_url );
|
$_indexless_current = untrailingslashit( preg_replace( '/index.php$/', '', $current_url ) );
|
||||||
|
|
||||||
if ( in_array( $item_url, array( $current_url, $_indexless_current ) ) ) {
|
if ( in_array( $item_url, array( $current_url, $_indexless_current ) ) ) {
|
||||||
$classes[] = 'current-menu-item';
|
$classes[] = 'current-menu-item';
|
||||||
|
Loading…
Reference in New Issue
Block a user