Support

Account

Home Forums Front-end Issues How to display a nav menu field without wp_nav_menu(); Reply To: How to display a nav menu field without wp_nav_menu();

  • Try one of these examples:

    To get both field and menu

    <?php 
    
    $id = '' //(string) (required) Menu 'id','name' or 'slug'
    $menu = wp_get_nav_menu_object( $id );
    $field = get_field('field_name', $menu);

    To get only the field:

    <?php 
    // WP < 4.4
    $post_id = 'nav_menu_1' //the number must be the menu ID
    // WP >= 4.4
    $post_id = 'term_1' //the number must be the menu ID
    $field = get_field('field_name', $post_id);

    EDIT: Different calls for WP Versions