How to retrieve items entered in the menu with Advanced Custom Fields

Here's how to retrieve items using `get_field()` when using the WordPress plugin 'Advanced Custom Fields' with custom menus.
Table of Contents
What I want to do
Set the display condition for Advanced Custom Fields to 'Menu'
Enter values into the custom fields of the relevant menu
Here's how to retrieve these values within your theme files.
How to retrieve items
I was able to retrieve it by adding the prefix menu_ to the second argument of `get_field`.
get_field('key', 'menu_' . $menu_id);
For example, if you want to retrieve the value of the custom field 'copyright' for a menu named 'footer', do this:
$menu_id = wp_get_nav_menu_object('footer')->term_id;
get_field('copyright', 'menu_' . $menu_id);






If this was helpful, we'd appreciate your support!
All support received will go toward my child’s upbringing.
Author's Baby Registry (Amazon)
Support me via OFUSE
Or support me by buying something through the buttons below
(You don't have to buy the specific item on the linked page.)
Support me via Amazon
Support me via Rakuten
Support me via Yahoo!Shopping
PR