Created
August 17, 2021 18:17
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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