Populating Advanced Custom Field Select with WordPress Menu choices

If you’ve ever wanted an Advanced Custom Fields Select field with WordPress Menu choices but wanted it to be dynamic, it’s pretty easy to do using the ‘load_field’ filter. That filter allows you to inject new select options into the field dynamically.

Using this filter, we can loop over our WordPress Menu items and then populate the field. Below is the code snippet that you can paste into your own functions.php file – just be sure to call your select field “menu_choice”. That field will now return a menu slug that can be used to fetch the menu.

https://gist.github.com/nickstewart95/7c312d023a252b8398e706ba41ab9af5