Simply omit the parent value.
$args = array(
'post_type' => 'attachment',
'post_status' => 'published',
'numberposts' => 12,
);
Check the documentation for other arguments: Function_Reference/get_posts.
Maybe you’d like to use the PHP command shuffle
, like shuffle( $attachments );
.
Related Posts:
- Cannot access the thumbnails of attachment images… Cannot find the reason
- How to make programmatic image upload generate thumbnail and sizes?
- Rebuild thumbnails via WP Cli – how?
- unsharp thumbnails after uploading image
- Blank image thumbnails in media library
- Media Library shows default image instead of image preview
- Programmatically adding images to media library
- How to delete resized (cropped) image uploads and prevent future resizing?
- Uploaded images don’t show in Media Library if there are special characters in IPTC Keywords
- What’s the proper way to find and remove duplicate images from posts and the media library?
- Is there a hook which fires after all thumbnails are generated?
- Separate Media Library for each user
- Cropped featured image replaces original image in gallery
- How do I delete all generated images from my server except those currently used in posts
- Remove duplicate images from media library.
- Use Media Library to manage galleries like Nextgen (with folders, albums, collections, tags, categories, terms…)
- No srcset for hard-cropped thumbnails
- Why would image paths in wordpress suddenly change?
- Removing Title Tag from Thumbnails
- Why can’t I edit certain images from the WordPress Media library?
- Uploading images: ‘ø’ get replaced with ‘ø’
- Regenerate missing _wp_attachment_metadata
- Best way to strip character entities (%20 etc)
- Image Quality Thumbnail Compression in WordPress?
- Get full image array
- Bulk image rotation
- How to order images in a post in WordPress 3.3?
- Show full image thumbnail
- Get thumbnail url of custom meta image?
- Check if the image exists in WordPress media library
- unattached media files that should be attached
- How to output images as figure/figcaption
- Image thumbnails not available post migration, but still accessible via direct URL – DB issue
- Upload media files to Amazon S3
- How to open default wp image editor screen dynamically?
- Update old Post image metadata to ‘thumbnail’ wp_attached_file
- Is it possible to split Default WP Media directory to multiple Folder/Subdomain?
- Fixing image names for a site being restored
- Images uploaded to the media library has strange colors. However, in the edit screen the color is ok
- Alter image meta fields in the Media Library
- Add custom text in the media library image meta area
- How to add images to a post without inserting them into the content area of the post editor?
- How do you alter the default WordPress thumbnail?
- Gallery with thumbnail carousel
- Uploaded images not displaying in network site
- Unable to upload images to the Media Library. Getting this erron on the console wp-admin/async-upload.php 403 (Forbidden)
- Is it possible to change image size used for preview thumnail in Add Media popup
- How to limit the number of images displayed in the media window?
- Create a post from every image in my media gallery
- Dynamic image crop in WP 3.0+?
- Get images attached to a specific page
- How do I get a smaller size of an avatar image
- Why WordPress suddenly changed sizes of thumbnails?
- Is there a way in WordPress to convert images to WebP without a plugin?
- Stop WordPress compressing images? – Quality is terrible
- Auto delete pictures in media library by age
- Images not showing in media grid view (but showing in list view)
- Some Images Disappeared from Media Library?
- Can we use featured image as third party website image URL
- Get an image from url, resize it, and save on a custom folder (not the media library)
- are unattached media files a problem?
- How to get the title of the random images from media library?
- add_image_size not working
- Product Images Low Quality After Updating From WP 3.5 to 4 [closed]
- How to change the value “uploaded to” in the media library (WordPress 4.0)
- Function to grab specific image IDs from media library.
- How to add thumbnails to posts and pages automatically in a uniformed fixed elegant way?
- Fetching uploaded images using Link URL
- how to change format jpg to webp?
- Allow wp media library to check already selected images displayed in div
- WordPress append -1 to the image name
- Images not showing after wordpres update 5.6
- how to regenerate webp et-pb-portfolio-image
- Auto Generate Thumbnail
- Could creation of various image sizes cause slow form submission response?
- imported post image as normal image instead encoded image
- Post-processing of the image failed
- When upload a PNG a noise appears in the thumbnails
- After moving a site to new hosting, not all images are showing in media library
- New portfolio items appearing smaller on the grid
- How to handle a lot of media files in the uploads folder? (+10.000)
- Broken images in media library
- Images are not getting uploaded
- Unable to delete images in Media Library
- Image thumbnail on single product issue | WooCommerce
- add titles to images in ad media in pages and posts
- Create a custom attachment thumbnail for quick page load
- Change the image for a certain URL
- Assign one featured image to multiple posts?
- Why are my ‘medium’ images the wrong size
- Broken Media Library
- Add custom version to an image
- How do I change a Themes Header Image?
- Media Library is not loading on grid view in admin panel
- Blurry Images WordPress 5.8.1
- Remote Image (from URL) as Media Library element
- Thumbnail size keeps resetting automatically
- Delete all thumbnails & regenerate them?
- What does WordPress media uploader do to image files on upload?
- Images have dissapeared from media library and site