Skip to content

Commit

Permalink
enhance(navi): Get WPML translated menu ID if available (#60)
Browse files Browse the repository at this point in the history
  • Loading branch information
slackday authored Jul 29, 2023
1 parent 1e3f0fd commit 623ddc6
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/Navi.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,14 @@ public function build($menu = 'primary_navigation')
{
if (is_string($menu)) {
$locations = get_nav_menu_locations();
$menu = array_key_exists($menu, $locations) ? $locations[$menu] : $menu;

if (array_key_exists($menu, $locations)) {
$menu = $locations[$menu];

if (has_filter('wpml_object_id')) {
$menu = apply_filters('wpml_object_id', $menu, 'nav_menu');
}
}
}

$this->menu = wp_get_nav_menu_object($menu);
Expand Down

0 comments on commit 623ddc6

Please sign in to comment.