Since I didn’t expected an answer to this question I tried it with wp_delete_attachment();.
I wrote this function on a random page of my site (since the site isn’t live yet) and executed it from there.
$attac_kill_ids = range(1235, 22686); //fill an array with the post_ids from the empty instances
foreach( $attac_kill_ids as $kill_id ){
$kill_post = get_post( $kill_id );
if( $kill_post ) {
wp_delete_attachment( $kill_id, true );
echo '<br />killed #' . $kill_id;
}
else continue;
}
‘delete‘ would be more precise, but ‘kill‘ sounds more dangerous and keeps me concentrated thereby.
Then I used this line in phpMyAdmin to set the ID-counter back to 810
ALTER TABLE wp_posts AUTO_INCREMENT=810
Related Posts:
- WordPress does not detect all images in uploads folder?
- Moving wp from a server to another, with different administrator
- How do I select an image from Media Library in my plugin?
- Media Library plugins for better file management? [closed]
- How to add subfolders in media library for better organisation?
- How to display .ico files in the media library
- print_media_templates not applied in media manager plugin
- Uploading Images to Media Library via wp_handle_sideload() fails
- display image size in media library screen
- image_size_names_choose filter doesn’t show
- Add class=”media_type” when media is inserted into editor
- How do I ‘rebuild’ the WordPress Media library after transfer to new host?
- Proper way to hook wp_get_attachment_url or any other way to change that url in media library
- How can I list URLs of all audio files within my media gallery?
- Migrating to HTTPS only, most media library links need updating?
- Failing to open advanced-cache.php which is breaking Media Library
- Add more rows on media picker
- Filter pictures in the media library [closed]
- Is there a way to delete images from the Media Library programatically?
- Add file name column to media library
- Is there a way to specify the tab to display when the Media Uploader is displayed?
- How to add ‘Attachment Display Settings’ in custom Media Library?
- Image width tag is less than the image pixel width – why?
- Register an additional image size for only some images in my media library
- WordPress 3.5 Media Manager – Reorder Selectbox items on Media Library Tab [duplicate]
- Change default screen option value for media items per page (in media library)
- Custom Fields Bulk Edit
- Share media among different domains
- Where is the source of the media items filter
- how to download all media files into my computer
- Add image to media library from URL in uploads directory
- Remove all links to a specific website
- Function to get image from media library
- Adding Alt Attributes Automatically when Uploading Images to Media Library
- Perform a custom (bulk) action in media view
- Media gallery thumbnails 1px
- How to have changes made in media library to be reflected on posts/pages
- How to retrieve alt attribute for an attachment (uploaded image)?
- How to bulk Edit Dates in Media Library?
- Remove the ‘Attachment Details’ section of the wordpress media manager
- Why do I sometimes get an attachment id string instead of a url from an image’s guid field in the post table?
- How to change compression of WordPress uploads including original image
- Creating bulk posts with Youtube videos
- Slow/Not Working Media Library Search
- wordpress not generate thumnails for mp4 videos
- Bulk delete users from a csv list
- Media Library not showing images properly
- Clean up wp-content/upload/ folder
- The best way to protect uploaded media in WordPress?
- I’m using add_meta_box() but want to include TinyMCE editor *and* Media Uploads for each box
- Media Library Grid View Custom Filter
- Not able to extend wp.media.view.AttachmentsBrowser
- Custom Media Modal and uploading
- Media Library SSL
- Get the largest image based on a thumbnail in a URL
- Creating subfolders in the media library
- date/time-picker and file upload (image) fields for custom fields (e.g. with more fields)
- Can I create my own custom Attachment Display Setting?
- Media library and posts list problems with WordPress on IIS
- Can I set multiple feature images to multiple posts from the media library?
- “add from media library” tab is super slow [closed]
- Media library disallows spammy filenames?
- Recalibrate _wp_attachment_metadata Image Dimensions
- Conditional tag to determine if the user is viewing the Add Media (after clicking Add media button)
- More Fields & Media Upload
- Adding Alt Tag and Dimensions columns to Media Library
- How can I delete duplicate `*-1.jpg` images?
- Extract url of every image in library?
- Media Library Latency, Lag, CRON?
- Is it possible to share WordPress media files among different domains?
- How to edit a deleted image gallery?
- What would be the URL to display the WordPress image editor with an image from the media library?
- WordPress ACF delete image from media library
- Renaming Custom Taxonomy Values
- Using the media library for theme customization
- Prevent other editors from viewing images of other editors in Add Media Popup
- Media attachment date and post date
- User media folder for each users on registration
- WordPress Media Import, images not in Media Library
- How can I no-index specific PDF files in my Avada WordPress media library so that they don’t appear in search results?
- Filter media library by custom postmeta
- Can’t upload format files on media library
- How do you find a file in the media library using the file URL?
- images inside wp-content/ uploads/ are not showing up in my media library and uploaded using FTP protocol
- Create “blank” admin page without having admin-bar/admin-menu for faster load
- add_image_size() in custom theme is not generating and saving any thumbnail
- flip horizontal images in bulk
- Organizing the Media Library for Cleanup
- how to setup user access media library?
- How can I add a Description column to the media library browser screen?
- Get filenames of available image sizes
- Use the “Media Library” in Frontend
- Why is my upload / Select media library button empty?
- All the Images in Media Library is showing broken links
- Add Filename Colum to Media Library
- 2 or more WordPress instances (Live vs Staging Test site) –> access 1 uploads.domain.com — images holder – see images in Media Library
- media library contains corrupt doubles
- How can I change the page title of PDFs opened from a WordPress link which use the browser’s viewer?
- Files showing in link but cannot be found in the upload directory
- in classic editor, is there a way to add media lib files to the content search when creating a link?