Skip to content

Instantly share code, notes, and snippets.

@dougkeeling
Created August 17, 2021 18:17
Show Gist options
  • Save dougkeeling/b07a8b61c71defb6fb13c28d0fb6094b to your computer and use it in GitHub Desktop.
Save dougkeeling/b07a8b61c71defb6fb13c28d0fb6094b to your computer and use it in GitHub Desktop.
[Get ACF Field from Menu Location] For fields assigned to menu locations (not to menu items). #acf #wordpress #php
// Menus are saved as terms, so get the term object first
$menu = get_term_by('name', 'Slideout Menu', 'nav_menu');
// Get field as you would from a normal taxonomy term, in the format "term_XX"
$field = get_field( 'field_name', 'term_'.$menu->term_id);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment