Have you tried to use get_children() function?
Edit:
All media attached to any post is treated as children of it. The function wp_get_attachment_image()
will only return images.
With the function get_children()
you’ll be able to get all the media, images or anything else.
In the above link, you can find some examples.
Related Posts:
- What is the alternative to “ when it comes to calling Media (image) files in the ‘attachment.php’ file?
- Remove “Insert from URL” link in Media upload – WP 3.5
- Adding a custom image upload size and making it selected by default?
- Hide custom image sizes from media library
- Hide old attachments from wp media library
- How to register images uploaded via FTP in media library?
- Admin Media grid view images won’t load
- Add custom image sizes to media uploader
- How to upload imagick resource to media in wordpress
- WordPress media upload “HTTP error”
- How do I get images (with a thumbnail preview) to show in search results?
- Adding a querystring to an image URL when clicking ‘insert into post’?
- WordPress automatically adds links to uploaded images
- Get featured image with custom size outside WordPress
- Convert all uploaded PNG files to PNG-8 format
- show/hide attachments
- Edit Image/Image Details – Replace button missing
- An automatic way to crop images of different sizes
- How to automatically convert images to WebP on WordPress?
- WordPress loading all local images from specific directory?
- Change the URL of an image from wp_get_attachment_image_src for Product Posts based on Category
- Update Images after edit via php
- not outputting medium size image URL
- Configure WordPress to Use Responsive Image Rendering
- How to use data URL in WordPress?
- Replace background image with post thumbnail in shortcode
- Resize post thumbnail
- Use PHP Class in WordPress functions
- Where Do Image Dimensions Get Added To A Filename?
- I have a background-image in css file but don’t show in site.how to fix this prblm. i sent screenshot. thx
- How do I stop an Image Address from loading in the Browser?
- can I extend the WP_Query class to deal with ‘duplicate’ posts created by joining to wp_posts?
- unsharp thumbnails after uploading image
- AJAX and custom pages
- How to get the url of the entry in which an image belongs
- How to add a PHP scripts into WordPress
- Post-processing of the image failed
- overwrite wordpress gallery with custom gallery shortcode
- Using custom php to connect to database blocks wp from accessing galery pictures
- Access variable from another class that was passed in constructor
- Featured images duplicating and replacing next image
- How to add typehints to function in functions.php when argument is an object?
- Proper use of Output Buffer for a whole php clas
- Get list of posts from attachment
- I can’t load my images from a js file using wp_localize_script
- Post images are not displayed in media library
- How to create an unordered list of images separate from the content
- Attaching an upload to a user
- Get the image title and alt from custom query
- How to include different html tags in the header for different pages?
- How to always display full size image
- Calling WordPress hook from within a class: call to undefined function error
- what’s the syntax for if the image exists get the image?
- Unable to delete images in Media Library
- How do I get the featured post to share on Social Media and show on Individual Post pages?
- wp_delete_attachment not working with multiple values
- Retrieving specific images from Media Library
- Can’t get data from audio media
- How do I routinely extract the thumbnail of the most recent post?
- Renaming “Expand Details” within “Add Media”
- Get posts associated with media attachment
- PHP calling function within a class
- What is wrong with assigning values to a WP_List_Table class?
- How to change this internal image link parameter using PHP?
- add class to background image
- Extend the WP_Customize_Image_Control class to change its non-frame $button_labels
- My customizer’s setting doesn’t set to the default and needed to click the control’s “Default” button before it’ll be set
- Save the outputted image into the Media Library, with a different filename and extension
- Edit image itself
- Pass php to database in JQuery: With AJAX?
- calling a function from a class in your template
- How to resize an image server-side before upload?
- Property value of null when value is assigned inside a method hooked to the wp action hook
- Missing Images in Uploads Directory (Server Only)
- Creating image gallery in wordpress
- Retrieve first image url from custom post with pagination
- Image limit from 1 to 5
- Name Input from widget displays Sidebar name instead of saved data
- Gallery requires a featured image but does not show it in posts/pages
- Broken Media Library
- Can’t upload files
- Snapshot Theme from WooThemes — empty ‘alt’ attribute
- Changing 2011 theme header image based on user dropdown
- Setting post thumbnail sizes in template file and functions.php
- images in wordpress themes
- Determine if only one image attached to a post/page
- How to use custom fields to replace top-level parent title with an image using wp_list_pages?
- Crop images in both sides on wordpress [duplicate]
- How to execute add_action() function from custom plugin to Crontrol plugin or do_action()?
- Issues separating my Plugin pages into different files
- upload images on front by user using form
- How do I return an image from a script
- Media Library is not loading on grid view in admin panel
- PHP-Code inside Href-Tag
- HTML in PHP problem [closed]
- Blurry Images WordPress 5.8.1
- Adding slides to an existing carousel manually
- Where to store the images of a custom WordPress theme?
- Display Post Titles on top of the_post_thumbnail()
- add if statement to the featured image