I have thousands of unattached images with no files. How do I delete them all quickly?
ls: cannot access wp-content/uploads/2014/09/jeep cherokee patriot-Ekza.jpg: No such file or directory
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It only takes a minute to sign up.
Sign up to join this communityI have thousands of unattached images with no files. How do I delete them all quickly?
ls: cannot access wp-content/uploads/2014/09/jeep cherokee patriot-Ekza.jpg: No such file or directory
That's a lot of unattached images. If you have couple of hundred images then you can delete them manually from media library.
1. Click 'Screen Options' at the top right and set 'Show on screen' to 200.
2. Click 'Apply'.
3. Click the checkbox just under 'Bulk Actions' to check all images on the page.
4. Select 'Delete Permanently' in the 'Bulk Actions' dropdown.
5. Click 'Apply'.
But if you have thousand of unattached images then it would be best to use a plugin. DNUI (Delete not used image) plugin will do that for you. It will let you delete tons of images from media library.
Or use DX Delete Attached Media
for
loop to list then remove the file, then deleted the rows from the database. I wish I saved the SQL and command line.