( $old_nav_menu_locations[ $location ] ); } } // If there are no old nav menu locations left, then we're done. if ( empty( $old_nav_menu_locations ) ) { return $new_nav_menu_locations; } /* * If old and new theme both have locations that contain phrases * from within the same group, make an educated guess and map it. */ $common_slug_groups = array( array( 'primary', 'menu-1', 'main', 'header', 'navigation', 'top' ), array( 'secondary', 'menu-2', 'footer', 'subsidiary', 'bottom' ), array( 'social' ), ); // Go through each group... foreach ( $common_slug_groups as $slug_group ) { // ...and see if any of these slugs... foreach ( $slug_group as $slug ) { // ...and any of the new menu locations... foreach ( $registered_nav_menus as $new_location => $name ) { // ...actually match! if ( is_string( $new_location ) && false === stripos( $new_location, $slug ) && false === stripos( $slug, $new_location ) ) { continue; } elseif ( is_numeric( $new_location ) && $new_location !== $slug ) { continue; } // Then see if any of the old locations... foreach ( $old_nav_menu_locations as $location => $menu_id ) { // ...and any slug in the same group... foreach ( $slug_group as $slug ) { // ... have a match as well. if ( is_string( $location ) && false === stripos( $location, $slug ) && false === stripos( $slug, $location ) ) { continue; } elseif ( is_numeric( $location ) && $location !== $slug ) { continue; } // Make sure this location wasn't mapped and removed previously. if ( ! empty( $old_nav_menu_locations[ $location ] ) ) { // We have a match that can be mapped! $new_nav_menu_locations[ $new_location ] = $old_nav_menu_locations[ $location ]; // Remove the mapped location so it can't be mapped again. unset( $old_nav_menu_locations[ $location ] ); // Go back and check the next new menu location. continue 3; } } // End foreach ( $slug_group as $slug ). } // End foreach ( $old_nav_menu_locations as $location => $menu_id ). } // End foreach foreach ( $registered_nav_menus as $new_location => $name ). } // End foreach ( $slug_group as $slug ). } // End foreach ( $common_slug_groups as $slug_group ). return $new_nav_menu_locations; } /** * Prevents menu items from being their own parent. * * Resets menu_item_parent to 0 when the parent is set to the item itself. * For use before saving `_menu_item_menu_item_parent` in nav-menus.php. * * @since 6.2.0 * @access private * * @param array $menu_item_data The menu item data array. * @return array The menu item data with reset menu_item_parent. */ function _wp_reset_invalid_menu_item_parent( $menu_item_data ) { if ( ! is_array( $menu_item_data ) ) { return $menu_item_data; } if ( ! empty( $menu_item_data['ID'] ) && ! empty( $menu_item_data['menu_item_parent'] ) && (int) $menu_item_data['ID'] === (int) $menu_item_data['menu_item_parent'] ) { $menu_item_data['menu_item_parent'] = 0; } return $menu_item_data; }
Fatal error: Uncaught Error: Call to undefined function register_nav_menus() in /home/sportuga/public_html/wp-content/themes/portugal-shoes/functions.php:50 Stack trace: #0 /home/sportuga/public_html/wp-includes/class-wp-hook.php(324): portugal_shoes_setup('') #1 /home/sportuga/public_html/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array) #2 /home/sportuga/public_html/wp-includes/plugin.php(517): WP_Hook->do_action(Array) #3 /home/sportuga/public_html/wp-settings.php(673): do_action('after_setup_the...') #4 /home/sportuga/public_html/wp-config.php(102): require_once('/home/sportuga/...') #5 /home/sportuga/public_html/wp-load.php(50): require_once('/home/sportuga/...') #6 /home/sportuga/public_html/wp-blog-header.php(13): require_once('/home/sportuga/...') #7 /home/sportuga/public_html/index.php(17): require('/home/sportuga/...') #8 {main} thrown in /home/sportuga/public_html/wp-content/themes/portugal-shoes/functions.php on line 50