Undefined array key “path”

I got error from this code please help me….
.
.

// search for custom section links in submenu items
if( in_array( ‘current-menu-parent’, $classes ) ) {

$nav_menu_items = wp_get_nav_menu_items( $args->menu->term_id );

global $wp;

foreach( $nav_menu_items as $nav_menu_item ) {

if( isset( $nav_menu_item->menu_item_parent ) && $nav_menu_item->menu_item_parent == $item->ID ) {

if( !empty( $nav_menu_item->url ) ) {

$item_url = parse_url ( $nav_menu_item->url );
$current_url = parse_url ( home_url( add_query_arg(array(), $wp->request) ) );
{{ isset($array[‘path’]) ? $array[‘path’]: ‘Default’ }}
if( ( $item_url[‘host’] == $current_url[‘host’] ) && ( rtrim($item_url[‘path’], ‘/’) . ‘/’ == rtrim($current_url[‘path’], ‘/’) . ‘/’ ) && !empty( $item_url[‘fragment’] ) ) {

$classes[] = ‘has-scroll-children’;

}

}

}

}

}

In this code i am getting this error:

Warning: Undefined array key “path” in /homepages/26/d917601565/htdocs/clickandbuilds/MyWordpress/wp-content/themes/my-theme/unite-custom/ut-theme-menu.php on line 1967

Please help me i didn’t understand what can I do here.

2 Comments
  1. The $item_url doesn’t seem to have a path key…

    Try to var_dump($item_url).. this will show you what exactly is in the array n if it’s an array or not…

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer