Yes, you’re right that the slimImageObject
function is the reason why you’re seeing/getting only those limited list of props.
But don’t worry, you can use wp.data.select( 'core' ).getMedia( <attachment id> )
to get the attribution
meta (and any other meta or props in the full attachment object). Here’s an example that worked for me:
items.map((item, index) => {
// Add this line and the attribution part in the attachment div.
const attribution = wp.data.select( 'core' ).getMedia( item.id )?.meta?.attribution;
return (
<div className="attachment" key={index}>
<figure>
<img src={item.url} alt={item.alt} key={item.id} />
</figure>
Attribution: { attribution || 'NA' }
</div>
)
})
Related Posts:
- How to display a shortcode caption somewhere other than the_content
- Extend core block attributes in post content
- How to change an image source when rendering on frontend?
- Surround uploaded image link with div
- Programmatically adding images to media library
- Programmatically get images by URL and save in uploads folder
- Can I attach image to post without adding it to post?
- Uploaded images don’t show in Media Library if there are special characters in IPTC Keywords
- get_post_gallery with Gutenberg
- Default Image Link Removal
- Remove title attribute from images
- Insert an image into a post by API
- Function to call the attachment image from post
- Get attachment ID of author_meta image – Attachment Metadata
- How to include externally hosted images into a gallery block
- Filter Media Library by author or post_parent
- Separate attachment images from post loop
- copy attachment title to description and alt text
- Alter image output in content
- How can I remove the image attachment ALT field?
- Open the attachment details modal
- add data-attribute to all images inside the_content()
- Allowing post attachments without allowing to insert in text
- Rename attachments during upload
- Regex to turn embedded images in to attachments
- Change html structure of all img tags in WordPress
- Regenerate missing _wp_attachment_metadata
- Make alt text required when setting a featured image
- Best way to programatically add “rel” attributes to page and post images
- How to remove buttons from gutenberg toolbar
- Display one random image, but only if landscape
- get_attachment_id() only get id of first attached image after post update
- Is there a way to get attachment data?
- What’s the proper way to use the get_image_tag filter?
- How to change image url?
- Can I the caption shortcode to set caption to a data attribute, and with the image’s alignment intact?
- get the image of the post
- media_sideload_image with rewritten urls?
- Out of memory error reporting
- How can I attach hotlinked images in posts/pages within the same server?
- Multiple images in one attachment page
- WordPress Image Attachment using remote image
- Is there any action/filter hook to use when an image gets edited in the editor?
- Exclude images from “inserted into post” when trying to get attachments
- How to remove attachments size attribute [duplicate]
- WordPress adds extra width to post images container boxes
- Handling image uploads without thickbox
- Update an image block style programatically
- How to add custom classes to figure element only if image has caption?
- update_post_meta attachment_image_alt description for Gutenberg
- Change align classes for images
- Auto delete attachments that are older than x days
- Images attached to posts from library link to 404 error page
- Help to upload post attachments from Ajax
- How to get the Gallery form/section just like in Gutenberg block?
- Call to undefined function wp_generate_attachment_metadata()
- How do you import images from a URL in your post?
- Get images attached to a specific page
- WordPress Creates Unused (Unregistered) Image Sizes
- How to upload and style svg logo?
- How to stop WordPress from completely overriding my tags in my templates?
- Is it possible to enable the ‘Link To’ field under ‘Attachment Display Settings’ for a Featured Image?
- How to test if there are no more previous or next image on attachment page?
- Show last 12 uploaded images on home page, but only from posts
- Excluding post thumbnail from the attachment.php when using wordpress gallery
- How to replace post image url before posting using api?
- How to get post id of first child of the same post type?
- Place image caption outside of figure tag (Gutenburg Image Markup)
- Change Image Size option in the settings in bulk
- get_post_gallery with Gutenberg
- How to join Caption AND Description Meta Fields as one combined-caption in Image Block
- How to change Gallery image url in product page ? In function.php?
- Rebuilding core image block
- How to get title of images in post content
- SQL: How to find all attachments that are not used in any posts/pages/custom_post_types
- Allow users to upload attachments to certain posts
- get_post_gallery with Gutenberg
- How to trigger “wp_handle_upload_prefilter” filter when uploading an image programatically?
- Get “Image CSS Class” value from the Advanced Options section
- Dinamically modifying attributes of images on posts
- Uploaded images not showing properly using wordpress
- How can I add an “Attach image to this post/page” link on the Add Media lightbox?
- How might one programmatically set the link for all images in all posts?
- Image filter works on attachement pages but not posts. I can’t get the image ID
- attachment.php & flexslider—linking thumbnail to specific image
- Create a custom attachment thumbnail for quick page load
- Setting name of attachment URL
- How can I hide previous_image_link() on first attachment page?
- Show title when inserting single images
- Upload unnattached image from frontend
- Image attachement management – a philosophical question
- wp_get_attachment_link() add rel attribute if the link points to direct image
- greater flexibility in targeting images attached to page
- Stop Attachment image names from taking top level permalink
- Multisite image URLs incorrect in editor
- Image Attachments Query Not Working If Post Is Loaded Via Ajax
- How can I use an image from an external source without uploading it to the media library
- Remove one srcset entry from wp_get_attachment_image
- Attachment tag archive
- Replace image with its alt text?