You could Limit the output to 1 like this but this is not a solution, only a workaround:
$args = array('post_parent' => get_the_ID(),
'numberposts' => 1,
'order' => 'ASC',
'post_type' => 'attachment',
'post_mime_type' => 'image'
);
$images = get_children( $args );
if ($images)
{
foreach ($images as $image)
{
echo wp_get_attachment_image($image->ID, 'full');
}
}
Have you the Premission to delete on your server?
Related Posts:
- get_children() not working properly – Only on one post?
- Make Images appear in the same order as in media browser using get children?
- Check if post has image
- wp_get_attachment_image_src and server path
- get_post_gallery_images returns thumbs . I want full size
- Remove P tags from images
- Any easy way to automatically set the first inline image in a post as the thumbnail?
- Why is wp_get_attachment_image not including “full” size in srcset?
- WordPress speed slow after .5 million single image post via wp-cli
- Why won’t these imported images show up?
- Remove rel=”attachment wp-att-XX”
- Using Taxonomy Image code with my get_categories code
- Generate fixed image sizes for different pages, eliminate sizes during upload
- Find posts without featured image? [duplicate]
- How do I add a featured image to a single post page?
- How to disable the suffix “-scaled” which is being added at the end of each uploaded image?
- In media library images are not displaying run time [closed]
- How to get image extension from wp image editor object?
- Best option for photo/gallery handling?
- Frontend Post – Allow Only Image File Upload
- Add a new data attribute in tag
- Images not working using Featured post
- File format of post image attachment
- Custom image sizes without add_image_size()
- SEO images in Nextgen Galleries
- Watermark images only for some users
- Can’t seem to attach uploaded image to post and set it as thumbnail
- Add an attribute to attachments
- Domain Change with New Image Sizes
- Why no images on a fresh WordPress installation?
- How to upload images in a specific folder using API
- AJAX – save an $_FILES picture in media library
- How to stop thumbnail generation from some images and different size thumbnail generate
- wordpress (woocommerce) add image to media library programmatically python
- How can I filter image HTML to add schema.org attributes?
- How to get file URL from media library
- How to implement secure frontend image upload? [closed]
- How to translate get_intermediate_image_sizes?
- Change media URL (images)
- Problem with images when no dimension in the URL [closed]
- some images not appearing on the website after migration [closed]
- WP 5.3 Removing Default WordPress Image Sizes
- How do I get my main image to stretch the full length of the screen?
- WordPress images not cropping properly
- How to make my site use HTTPS for images or how to insert images as relative paths?
- HowTo: develop WP template with dynamic background image
- Featured Image or Post Thumbnail Displaying on index.php?
- Clicks registering on Preview DNS site
- What did I do WRONG?
- Add retina “2x” in attribute “srcset”
- Large image not showing dimensions in Media Library
- Change logo image condition based on url
- Hiding Media Source Links
- How to create a title images for different posts?
- Random Characters in the end of every image url in post
- resize and crop thumbnail photos
- Broken thumbnails (sometimes) with TimThumb
- Can i have 2 separate Galleries on 2 separate pages each go to a DIFFERENT Attachment.php file?
- Why is my table background image not showing in wordpress?
- WordPress Media Library – how to “uncache” images
- Trying to change the URL of a product image once I upload it, but there seems to be no way to access the URL
- Is there a way to add a featured image to an image/file attachment page?
- Media Library Cleanup A Thought Exercise
- WordPress Multisite: Images moved to /sites/1?
- Site only working in browser where I created it
- wp_download_url() for dynamically generated image
- link not working in image section
- Images missing from Blog post page
- Page size too big due to images
- Full size image from srcset ALWAYS used on mobile DESPITE setting size of image in editor
- Run function before uploaded image is saved
- Are WP images responsive by default?
- Prevent WordPress from creating individual size images
- wordpress images not showing properly
- Keep the original ratio in a thumbnail image
- How can I set different banner images using background cover at different breakpoints?
- variable crop option with add_image_size()
- Plain image uploading – no links, no classes, no sizes
- Images with excerpt function
- How do I get resized thumbnails?
- How do I embed an image at actual size?
- Display ajax preloader for large images within posts
- Why is WordPress loading a different sized post thumbnail?
- Uploading Full Size Image vs Resizing Before Upload
- Insert image doesn’t pickup right size
- Storing images on a local site
- Adding Multiple Images to Sidebar Through Dashboard
- Tried everything but Facebook share button won’t load the post thumbnail
- Set image dimension for WP_Customize_Image_Control images
- Stop underlining image links
- How to hide image alt text/caption in Visual Composer?
- How to get attached image alt text in media.php?
- Why some images are not allowed to be edited only for thumbnails?
- problems with alt text not appearing in source code
- WordPress Theme: replace logo image with title site if file doesn´t exist on server
- WordPress update leads to 404 error on admin page and signup. CSS mishap with all plugin related functions
- How to get dimension of Logo and Crest
- WordPress Missing Images
- Display first image’s caption
- The uploaded images are only full-size (original)