The following code should work for you,
$images = get_children( array('post_parent' => $post_id, 'post_type' => 'attachment', 'post_mime_type' => 'image') );
$image_ids = array();
if($images){
foreach( $images as $imageID => $imagePost ){
array_push($image_ids, $imageID);
}
}
The array $image_ids would get you the image IDs.
Related Posts:
- get_post_gallery_images returns thumbs . I want full size
- Media Upload Folder – how to manage
- Wrong image dimensions in Insert Media after add_image_size()
- Remove P tags from images
- Any easy way to automatically set the first inline image in a post as the thumbnail?
- Upload multiple images in a custom metabox
- How can I hide media library images from general users?
- WordPress speed slow after .5 million single image post via wp-cli
- How to add php to theme to show alt attributes
- Why won’t these imported images show up?
- Remove rel=”attachment wp-att-XX”
- Using Taxonomy Image code with my get_categories code
- Generate image size, based on the image-orientation
- Rename image during upload using date and time stamp?
- How to Add extra option to Image Block Settings?
- Upload thousands of images to WordPress without plugin?
- Images in the Twenty Fourteen theme
- Get author ID with attachment ID
- Automatically replace original uploaded image with large image size
- Problem with loading images from child theme CSS file with relevant path
- Bulk edit Gutenberg single images to change from linking to media file to attachment page
- Generating different dimension images while uploading image file from custom plugin page
- is it possible to crop cover images in buddypress?
- Any specific reason why images do not show on site?
- Disallow img tag in comments?
- Bulk edit of EXIF data for jpeg images uploaded in the media library?
- In Wordress one author can not see the other’s author uploaded images through media library
- Regex expression for redirecting image URLs to another folder
- Why are images created by WP larger than the original uploaded image?
- Scaling images for mobile
- How do I fix “Sorry, this file type is not permitted for security reasons”
- Add suffix to uploaded images
- Image LazyLoad plugin not loading jQuery dependancies with wp_enqueue_script in WP 3.3.1
- How to make thumbnails of uploaded animated gifs NOT animated
- Frontend Image Upload
- Multiple variables through wp_get_image_editor
- Removing featured image from gallery?
- How to add image in rss?
- Rewrite inline image markup
- URL through custom field returning null
- How to set a Background image in WordPress?
- Images don’t load erratically
- Weird encoded error when using wp_generate_attachment_metadata()
- big trouble with javascript
- I want to rel=nofollow wordpress images
- Local install not loading template images but is loading everything else XAMPP
- Display cropped thumbnail not featured image
- Hide image gallery in Woocommerce if NO image [closed]
- All 3?: Responsive resizing of images + image width of actual image for small images + max-width for all larger images
- How to get the cropped image from media library?
- wordpress makes duplicate images of different size
- Add a span tag around image
- fitting the thumbnail image into a div
- Attachments without images
- Responsive Images from S3 has no srcset
- How to only show div of caption if caption exists on featured image
- How to “lazy load” post thumbnail
- Editing already up-loaded images
- Landing Page with HTML CSS JS and Images on wordpress
- Change Image URL on upload to some random number automatically
- wp_insert_attachment() dupplicate attachment posts
- Image title replace with current date
- WordPress Responsive Image ( srcset ) not work properly
- Product Gallery Images to go into full size on Product Page
- Why does wp_get_attachment_image_src return the wrong size, when the correct size exists?
- add_image_size limiting sizes (???)
- WooCommerce Variation Swatches and Photos – get attribute thumbnail
- link image file path embedded HTML
- Responsive Images in WordPress
- Is it possible to remove spaces from existing images? [closed]
- Troubles with code for upload a image
- get_post_meta returning broken path in image src
- Custom WordPress Theme – No Slider(s) Images
- Get image from one page and show/add it on another page
- Featured image on page set as “Posts page” in Settings > Reading
- problem with updating metabox of upload image
- How to have a specific image show up for everyone who comments?
- Images not showing after moving site
- Plain image uploading – no links, no classes, no sizes
- Thumbnail gallery by date and taxonomy
- 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
- Insert image doesn’t pickup right size
- Storing images on a local site
- Images will not attach to posts after site migration
- 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)