WordPress.org

Make WordPress Core

Changeset 19658


Ignore:
Timestamp:
01/03/2012 06:27:59 PM (9 years ago)
Author:
ryan
Message:

Properly handle a blank nav menu custom URL when determining what page we're on. fixes #19699 for 3.3

Location:
branches/3.3
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/3.3

  • branches/3.3/wp-includes/capabilities.php

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • branches/3.3/wp-includes/nav-menu-template.php

    r18746 r19658  
    363363            $_root_relative_current = untrailingslashit( $_SERVER['REQUEST_URI'] );
    364364            $current_url = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_root_relative_current;
    365             $item_url = untrailingslashit( strpos( $menu_item->url, '#' ) ? substr( $menu_item->url, 0, strpos( $menu_item->url, '#' ) ) : $menu_item->url );
     365            $raw_item_url = strpos( $menu_item->url, '#' ) ? substr( $menu_item->url, 0, strpos( $menu_item->url, '#' ) ) : $menu_item->url;
     366            $item_url = untrailingslashit( $raw_item_url );
    366367            $_indexless_current = untrailingslashit( preg_replace( '/index.php$/', '', $current_url ) );
    367368
    368             if ( in_array( $item_url, array( $current_url, $_indexless_current, $_root_relative_current ) ) ) {
     369            if ( $raw_item_url && in_array( $item_url, array( $current_url, $_indexless_current, $_root_relative_current ) ) ) {
    369370                $classes[] = 'current-menu-item';
    370371                $menu_items[$key]->current = true;
Note: See TracChangeset for help on using the changeset viewer.