diff options
author | Ryan Boren <ryan@git.wordpress.org> | 2012-01-03 18:27:59 +0000 |
---|---|---|
committer | Ryan Boren <ryan@git.wordpress.org> | 2012-01-03 18:27:59 +0000 |
commit | 352bf84cca47a0ddb2fc02014879e1f0e0db8745 (patch) | |
tree | 32ab100d9e7e5947236a793530e78614ba16dfb0 | |
parent | 87f329ae6dc77c7e7de4b990a027b98dc602a582 (diff) | |
download | wordpress-352bf84cca47a0ddb2fc02014879e1f0e0db8745.tar.gz wordpress-352bf84cca47a0ddb2fc02014879e1f0e0db8745.zip |
Properly handle a blank nav menu custom URL when determining what page we're on. fixes #19699 for 3.3
git-svn-id: https://develop.svn.wordpress.org/branches/3.3@19658 602fd350-edb4-49c9-b593-d223f7449a82
-rw-r--r-- | wp-includes/nav-menu-template.php | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/wp-includes/nav-menu-template.php b/wp-includes/nav-menu-template.php index ad6b5aa931..f412c8db45 100644 --- a/wp-includes/nav-menu-template.php +++ b/wp-includes/nav-menu-template.php @@ -362,10 +362,11 @@ function _wp_menu_item_classes_by_context( &$menu_items ) { } elseif ( 'custom' == $menu_item->object ) { $_root_relative_current = untrailingslashit( $_SERVER['REQUEST_URI'] ); $current_url = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_root_relative_current; - $item_url = untrailingslashit( strpos( $menu_item->url, '#' ) ? substr( $menu_item->url, 0, strpos( $menu_item->url, '#' ) ) : $menu_item->url ); + $raw_item_url = strpos( $menu_item->url, '#' ) ? substr( $menu_item->url, 0, strpos( $menu_item->url, '#' ) ) : $menu_item->url; + $item_url = untrailingslashit( $raw_item_url ); $_indexless_current = untrailingslashit( preg_replace( '/index.php$/', '', $current_url ) ); - if ( in_array( $item_url, array( $current_url, $_indexless_current, $_root_relative_current ) ) ) { + if ( $raw_item_url && in_array( $item_url, array( $current_url, $_indexless_current, $_root_relative_current ) ) ) { $classes[] = 'current-menu-item'; $menu_items[$key]->current = true; $_anc_id = (int) $menu_item->db_id; |