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);
?>
</p>
<?php
}
}
?>
Related Posts:
- Explanation of update_post_(meta/term)_cache
- Check if Post Title exists, Insert post if doesn’t, Add Incremental # to Meta if does
- Adding meta tag without plugin
- Sanitizing integer input for update_post_meta
- if get_post_meta is empty do something
- Meta compare with date (stored as string) not working
- How to update/insert custom field(post meta) data with wordpress REST API?
- Remove WordPress.org Meta link
- Front-end update_post_meta snippet displays white screen?
- Give extra post-meta to RSS feeds
- How to get meta value in wp_attachment_metadata
- Clean up output added via wp_head()
- Short of raw SQL, can I query for multiple attachment metadata that have a given array key?
- get_post_custom()
- Get post from meta_key and meta_value
- get_post_meta returns bool(false)
- How to get custom post type to display post meta on archive pages?
- Mass importing json data into custom fields (postmeta)
- How to echo get_post_meta (Fluent-Framework)
- WP_POSTMETA changes site crash
- meta_post_meta return value 1
- How to use post_id with a Class?
- how do I set a schedule event to modify all posts’s meta value weekly or monthly?
- How to stop wp_postmeta from being called on archive and search pages?
- How to use update_post_meta() function properly?
- WordPress front-end media (image) upload ERROR!
- running function during post save and adding variable to post meta
- update_post_meta saves nothing in database when run in publish_post
- Can’t access post meta on new post creation (cpt)
- How do I dynamically call a page/post author into the meta data?
- Custom post meta values reset by autosave [duplicate]
- Compare meta_query with a Regular Expression and do a less-than operation on it
- Is it possible to retrieve a post and its metadata at the same time?
- cleaning up safely wordpress wp_postmeta table
- Post meta as array looks like string instead of array
- Why does get_transient() always return string even if integer set?
- Author_meta ONLY if it exists
- Time & Date on Post – Time Ago Custom Function
- How to test the outcome of a wpdb query?
- How do I manage custom meta in post revisions in the Block Editor era?
- Generate metadata for cloud images
- Migrating meta value to new meta value
- Is there a way to disable post meta caching for development?
- Insert multiple metas in one time
- How to extract data from a post meta
- Correct meta of Writing Meta Tags
- Get post_meta from specific post [closed]
- How to add tags to post from frontend?
- Retrieve user_meta and copy to post_meta
- update_post_meta not working?
- Change wordpress meta tag description using WP functions
- getting the post_id from the post_meta
- troubles with get_post_meta (and saving it)
- Cant create or update meta fields using WordPress REST API
- Filter posts by meta key
- Display current ranking of post as a number in post title
- delete duplicates wp_postmeta
- Post Thumbnail missing when using webp format while sharing
- Bulk Update Post Meta Values from Different Post via Rest Api
- update_post_meta() is not saving the value
- Only show meta on one post type on search results page
- How to register post meta with multi level arrays?
- How to exclude posts by meta key value in the_post_navigation next prev links?
- If I disable screen options, does WP still try to update post meta?
- Can we have duplicate key pair values in post meta data?
- I created a Custom Meta Box but it is not displaying the value on my post page
- Meta data being pulled from wp-login.php
- Update post meta date always store 1970-01-07
- Is it possible to pass an whole array using custom field in wordpress?
- Get post content before rendering
- wp_insert_post inside save_post adds wrong metadata to inserted post
- Rename image filename using ‘media_handle_upload’
- How do I update a specific value within array in a products metadata?
- Update Post metafield of specific categories
- Optimize WP Meta Query for large amount of post meta?
- Using Self Hosted Video URL With Custom Fields
- Multiple postmeta values to the same post_id/meta_key combination?
- get_post_meta not work in php foreach
- Why are my custom metaboxes not updating the post meta?
- Problem serializing single quote and double quote into post meta
- Storing post_meta fields in array
- Performace on 1 million plus meta fields vs 1 field with 1 million multi array
- Fetching array of postmeta with $wpdb and in_array conditional
- Piklist File Upload
- php wp_insert data on front using a form
- Updating post_meta when updating a setting with the Settings API
- How to show specific meta keys of all posts in admin panel?
- wp_schedule_event not working
- how to echo/display the custom field value in specific custom field name?
- update_post_meta() not working in bulk option
- How to update the ‘modified_time’ of a post ONLY when content is changed?
- Multiple If else statements on Search Result Page
- WordPress join posts with meta values of array type
- How to make certain content of the post noindex and no follow. not entire post?
- Export posts with postmeta without ID?
- get_children filter with postmeta
- How can I display my meta value in a textarea? [closed]
- delete blank space in post_meta empty [closed]
- Auto save title as custom meta field value
- Save frontend submission form field as custom field