“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 ID
s 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?
- Difference between meta keys with _ and without _ [duplicate]
- Change admin bar to default:off
- Template for individual post designs
- How to determine if a category is empty?
- The seventh parameter passed to add_submenu_page()
- What would happen if the admin installs a plugin when the plugin is included in the theme?
- How do I get my child-theme to work with my theme’s includes folder?
- Remove frameborder attribute from iframes
- how do I get a sidebar’s id or number for use with is_active_sidebar()
- WordPress as a data intensive web app
- How to determine which custom header image is being shown
- using wordpress without javascript
- Theme Check: Could not find post_class
- Override theme programmatically
- can’t understand _e function well
- WP 3.1 upgrade breaks AutoFocus+ theme
- Change content layout based on menu hierarchy
- Theme Loading Into Dashboard
- How to make theme elements customizable in wordpress?
- How to obtain a reference to the_excerpt() from custom loop
- Query & Order posts by custom fields
- defining a folder location in order to recall it
- How to update custom field in WooCommerce
- JavaScript stops working on selectively refreshed sections one inside the other
- Why doesn’t my css work when I check my theme on mobile devices? [closed]
- Common single page template options
- Custom Blocks as part of a theme
- How to set up diffrent mobile theme for single site in WordPress?
- Enqueued JavaScript is not working
- Avoiding ACF get_field and returning to core WordPress function
- How to fix : Uncaught ArgumentCountError: Too few arguments to function? [closed]
- I have WordPress setup on primary domain, how do I set it up on its subdomain using the same database?
- How to enable Disqus comments in a WordPress theme I’m creating from scratch? [closed]
- Display posts with empty custom field
- tiny_mce_before_init: ‘exact’ => true has no effect
- Pagination not working on custom post page
- Any way to update_post_meta with html content? It gets stripped and becomes empty
- Can’t change theme name
- delete duplicate meta_value with same post_id
- multiple queries to get posts from same category?
- Stop WordPress from showing images on non post pages
- enqueuing external and internal js and css in wordpress did not work with owl.js animate.css
- Problem with pagination link (error 404)
- Custom meta fields not showing up in WP_Response Object via custom endpoint
- WordPress wp_get_current_user returning blank values until refresh
- use a single nonce in three different nonce field
- Whether an tag is required in header?
- Theme is Enqueueing Everything in Footer
- Local theme changes upload on server but theme changes not showing
- wp_kses allow checkbox class and checked
- Understanding WordPress theme files and underscores
- New theme HTML5 Support for Search in WordPress 4.4
- Media Attachment Custom Meta Fields not saving in Media Uploader when using jQuery UI Autocomplete
- What are these variables and where are they documented?
- Use external fonts in WordPress stylesheet
- Custom link color or stylesheets
- Feeds are showing where Post archive page should be
- I want to resize post featured image without cropping image. How?