“Attachments” aren’t meta data. That is why you can’t retrieve them with get_post_meta(). “Attachments” are a post type that is attached to the parent post. You need to pull the attachment posts that have you post set as parent, and then use those IDs to get the attachment meta.
$args = array(
'post_parent' => $post->ID,
'post_type' => 'attachment',
'numberposts' => -1
);
$children = get_children($args);
foreach ($children as $c) {
$att = wp_get_attachment_metadata( $c->ID, $unfiltered );
var_dump($att);
}
Related Posts:
- Make a custom field in admin post.php read only
- How to add a checkbox element to attachments editor with example
- How to sanitize select box values in post meta?
- Strategy to get post meta for use outside the loop
- Set Expiration Date of a Post from the Frontend with wp_insert_post
- Change loop order via form or link (jquery, not URL)
- Why is unfiltered html allowed in custom fields for author / contributor roles?
- Using the theme options to change background
- wp_editor() usage in custom meta box
- Is there a need for nonce with Post Metabox?
- Custom Field returning Numerical Value for Image rather than URL
- Metadata Query when storing data as array possible?
- Custom post fields
- How can I create a list of page titles from custom meta values?
- How do I Add images uploaded in the post to a default custom field
- Custom Field created in add_meta_boxes reappearing itself again in the default Custom Metabox
- How do you replace content generated by custom fields with custom blocks in Block Editor?
- Sort wp_query by sum of two meta fields
- What’s the best practice way of handling custom fields in different post formats?
- Custom page template with custom fields
- Wp Super Cache stops the update of a Post Meta
- Where WordPress Stores The Custom Fields Values
- How to show specific post meta?
- Running a function on post update with new post meta
- What is the best way to build home pages with a lot of sections for distributable themes [closed]
- How to add post meta fields to an article’s as meta elements
- Is it possible to set a variable for get_post_meta?
- Injecting pre-defined text from custom page template to editor
- Let user to add input fields on theme option page
- How to use shortcode inside of shortcode in theme
- Add image URL automatically to custom field?
- How can I sort my loop based on meta data, using a form?
- Related Post Category Filter
- How can I add a field for featured image on backend of a custom Taxonomy?
- How to fix a conflict cause by my theme with Woocommerce and/or Gravity Forms?
- I want to change the author name
- How to add custom field option with menu?
- Change default options on attachment page
- Add custom field to existing meta box?
- Add Field To All Pages
- After a while attachment meta data is missing “sizes” data
- Why is my Toggle field not showing in Gutenberg?
- How do I access the current post object within a block theme template or pattern?
- Menu items description? Custom Walker for wp_nav_menu()
- How to define and link full path to css located at a random folder on header.php
- Sizing screenshot.png without losing aspect ratio
- Software for WordPress Theme and Plugin Development? [closed]
- When to use is_home() vs is_front_page()?
- What is the preferred way to add custom javascript files to the site?
- Get the blog page URL set in Options
- How to create .pot files with POedit?
- How do I get the theme URL in PHP?
- Why when I submit a form in wordpress it loads a 404 page though URL is correct
- what is the correct way to compare dates in a WP query_posts meta_query
- What is the constant WP_USE_THEMES for?
- Worthwhile to restrict direct access of theme files?
- How Do I Protect My Premium WordPress App Theme from Copying?
- How to detect mobile devices and present them a specific theme?
- Can I exclude a post by meta key using pre_get_posts function?
- Advanced search form with filters for custom taxonomies and custom fields
- Using wp_add_inline_style without a stylesheet
- How to update custom fields using the wp_insert_post() function?
- How to add posts to custom menus?
- WordPress Theme Preview Image
- How To extend WP_Customize_Control
- How to display value of custom fields in page
- What is the difference between front-page.php and home.php? [duplicate]
- Can wp_query return posts meta in a single request?
- How can I get page slug
- Does the functions.php file ever get called during an AJAX call? Debug AJAX
- When to use _e and __ for the translation?
- What is a Theme textdomain?
- How to show a custom meta box on the “Quick Edit” screen?
- How to add CSS class to custom logo?
- How to add custom css file in theme?
- How important is it to enqueue a theme’s stylesheet?
- CSS not updating in browser when I change it
- Display Search Result Count
- wp_nav_menu(), how to change class?
- theme path in javascript file
- Is wp_is_mobile() effective?
- Display Menu Name using wp_nav_menu
- Making update notification functionality for my themes
- What questions do you ask when asked to give an estimate on theme development?
- How to remove dashicons.min.css from frontend?
- How do I remove a pre-existing customizer setting?
- Minimum Template Files for Theme Development
- What’s the difference between home.php and index.php?
- pass object/JSON to wp_localize_script
- get_template_part vs action hooks in themes
- Theme Activate Hook
- Solutions for generating dynamic javascript / CSS
- wp_redirect() – headers already sent
- Can I create my own “Recent Posts” widget or customize the existing one?
- Custom single template for a specific category
- how can I add an icon/image for a child theme?
- How can I add a URL field to the attachments window?
- The the_post_thumbnail without srcset?
- The proper way to include/require PHP files in WordPress
- Get the first image from post content (eg.: hotlinked images)