get_post_meta remains empty while looping all menu items and using the ID
You are sending the ID of the menu item not the ID of the page try using url_to_postid() like this: <?php $array_menu = wp_get_nav_menu_items(‘header-menu’); $menu = array(); foreach ($array_menu as $m) { if (empty($m->menu_item_parent)) { ?> <h4><a href=”https://wordpress.stackexchange.com/questions/257249/<?php echo $m->url;?>”><?php echo $m->title;?></a></h4> <p> <?php global $wp_query; $pageID = url_to_postid( $m->url ); echo get_post_meta($pageID, ‘meta_box_subtitle’, true); … Read more