What WordPress function can be used to retrieve a Menu Name using the Menu Location as parameter?

1 Answer 1


To retrieve the Menu Name:

$menu_name = wp_get_nav_menu_name("menu-products");

Then, using the menu name you can get data like the nav menu:

$term = get_term_by('name', $menu_name, 'nav_menu');

And using the term taxonomy ID you can pull the ACF fields

$menu_id = $term->term_taxonomy_id;
$post_id = 'term_'.$menu_id;
$field = get_field('my_acf_field', $post_id);

To retrieve list of menu Items:

$menu = wp_get_nav_menu_items( $term );

On the CMS side, the ACF Group, you need to select the Rule: Menu Item | Is equal to | Product Location

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.