I am trying to create some sort of custom menu. Where I list all titles of my pages in the main menu and display the value of a meta box of each of these pages. For some reason the get_post_meta remains empty for all items. I fail to see why.
<?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="<?php echo $m->url;?>"><?php echo $m->title;?></a></h4>
<p>
<?php echo get_post_meta($m->ID, 'meta_box_subtitle', true); ?>
</p>
<?php
}
}
?>
global $wp_query;
? – TrubinE Feb 20 '17 at 20:38