Home Forums ACF PRO Menu enhancement for WordPress Reply To: Menu enhancement for WordPress

  • This is not something that ACF will do. This is something that you’d use the hook wp_nav_menu_items and wp_nav_menu_objects to do. The references are here and here During this filter is where you’d need to alter the links to each menu item.

    I couldn’t begin to tell you how to tell what page the link should be to, you could maybe add a link to each page to tell what page should be linked to, but I don’t know what information you can get on each page or how you would get the ACF values for a page based on the link value.

    There is an explanation of how to use ACF fields in a menu here and here, but this is based on adding custom values to the menu and not to the page.

    Basically, you’d need to get the current page id if it is available when the menu is created, I do not know if is_page() will work here. Then you’d need to get the link value from the page. And finally replace the link that’s generated with your new html code for the alternate link. You could add a custom field to each menu item? checkbox maybe? Then if the checkbox is checked you might be able to set the url?

    Sorry I couldn’t be more help. I have not had the opportunity to use the new menu location features of ACF so I’m only able to provide a direction to look.