From the WP-CLI documentation about wp post delete
:
wp post delete --force $(wp post list --post_type="attachment" --format=ids)
See wp post list
for additional information.
Related Posts:
- Get all posts (of any post type) an attachment is used in
- Unattaching unlinked images
- How to retrieve alt attribute for an attachment (uploaded image)?
- Media Library Mess After FTP … /uploads
- How to Fix HTTP Error When Uploading Images?
- How to manage attachment relationships for specific posts in WP 3.5+
- How to trigger a refresh in the media modal
- Programmatically adding images to the media library with wp_generate_attachment_metadata randomly fails
- Expanding new Media Uploader in WordPress 3.5
- Uploading Multiple Attachments From Front-End With A Description
- complex restriction of items in media library
- Edit image / Delete image link
- media_sideload_image file name?
- Password protect some uploaded files, so only logged-in users can view them
- How to single click to download image in single post
- Show Post ID in “Find Posts or Pages” box in Media Library?
- Delete attachments from Front end
- Get attachments (get_posts) and WP 3.5 new uploader
- Gel all image from certain post type
- Can i hide the attachments from media which I uploaded from front end?
- Get the attachment URL on single.php
- How to count media attachments?
- Get url from file uploaded in Media Library
- Perform a custom (bulk) action in media view
- How to make a customized “Create Gallery” tab in the ‘Add Media’ window?
- Get the path of the first attached media (single.php)
- Show attached media image if no thumbnail image detected
- How to fetch only media that was already attached to a post/page?
- Audio file’s length (duration) is missing from Attachment Details in Media Library [closed]
- Post edit – Media Library – Only get images from current post
- Attach media to multiple posts
- Where does the gallery shortcode gets its attachments from?
- media ‘path’ issue / concern when bringing files live
- Control attachments menu order with jQuery Sortable
- How do I modify the “Insert Media” lightbox in the admin to only show media items from a category?
- Media library quick/inline edit
- Is it possible to share media files between multiple WordPress sites?
- Open the Attachment Details popup
- How to compress image before inserting to wordpress using wp_insert_attachment function?
- Massive photogallery import
- Proper use of wp_get_attachment_image?
- how to get random media id from media gallery
- Get images attached to a specific page
- the_time() returning wrong date/time (way in the future)
- Gutenberg Block: Image resolution
- WordPress Attachments with old images
- Upload multiple image with media_handle_upload with multiple file field [duplicate]
- Get an image from the media library. Struggling with the code?
- get all images from the wordpress media library with link to the post they are associated with
- How can i set media attachments to the author of the post or page for already existed posts with attachments
- Media item permalink goes to source file instead of attachment.php
- Adding attachment custom field metadata to TinyMCE tag
- wp_get_attachment_image_src calling wrong location
- wp_delete_attachment doesn’t delete image files / doesn’t work
- Removing images deleted from uploads folder, from Media Library
- Setting an image as post header (not featured image)
- Using the GetMediaLibrary() method in python-wordpress-xmlrpc.media, how to iterate over the result?
- WP media attachment location vs permalink
- Removing delete permanently button in uploading files media
- Retrieve ONLY mp3s and set a variable for use in a playlist called by single.php template?
- controlling whether upload is attached to post or not
- Remove attached media
- Is there a way to add Reattach and Unattach links in image gallery?
- How to retrieve images contained in a post
- How to save media-form on custom tab
- Media library only show 2 items per page?
- Bulk delete media by year
- Media library upload hook
- Where do the favicons for Media Files come from
- Hide Default Video Shortcode Controls on PageLoad
- Restricting access to files within a specific folder [duplicate]
- Media items hogging pretty permalinks
- query attachment images … if no attachments -> get attachments of parent page?
- Replacing with(out) regex link to attachment by links to files
- Getting attachment images is cloning some of them
- Detach an image from a page using php
- Images not being generated at correct size
- custom admin thumbnail for videos, not getting post’s id?
- Filter Media by Featured on Admin
- Image Gallery Numbers for 3.5
- How to open default wp image editor screen dynamically?
- How to filter a post in the Tag Cloud widget, using tags of a media library image attached to the post?
- Query to only return the 2 newest post attachments (images)?
- problem in uploading attachment to custom directory
- Media Library not showing images but still acknowledges existence
- filter get_children to return all mime types EXCEPT ‘x’
- Weird string offset errors when displaying post attachments
- Links to my uploads went crazy
- How does WordPress decides how many sizes of an image to create?
- WordPress append -1 to the image name
- Auto delete content in specific folder inside media library
- Which post/page an image is attached to
- How is it possible that a gallery doesn’t have attachment ids?
- Front-End Upload media with category
- Creating multiple instances of Media Uploader
- Handle image file and save it to media
- How to create different media uploader frames / filter library depending on a custom action
- Get video attachment ID and display length
- Add link to attachment for old posts
- Move caption in on attachment page