You’ll see I’ve labeled images “1,” “2,” and “3.” Each of these are “unattached,” but each is being used.
#1 – Being used by widget in the footer
#2 – Being used by the theme for the front page hero area
#3 – Being used by a “coming soon” plugin
Now, here’s my concern. If I simply delete all media that is “unattached,” then even media being used will be deleted. However, I’m not exactly sure which of the “unattached” media are being used. When I try attaching the media, it wants to know to which post or page it’s to be attached. However, the answer is “none.”
Is there a way to tell which media are being used, not just “unattached”?
]]>This means that whether media is attached or not is not a reliable way to know if the media is used, as you’ve discovered. Unfortunately this is the only time WordPress ever makes a database record of when media might have been used. The only other way to tell would be to scan post content for image URLs and compare them against the media library.
Thankfully some plugins exist to do this for you. I’ve found https://www.ads-software.com/plugins/media-cleaner/ and a paid plugin: https://www.nicearma.com/delete-not-used-image-wordpress-dnui/ I haven’t used either myself, so couldn’t comment on their quality.
One thing I would be careful of is whether these plugins handle custom fields, widgets, or custom tables added by plugins, because images could be in use that aren’t in post content, but are somewhere else. Keep that in mind when evaluating these plugins.
]]>I have the same issue. WC/WP seems to manufacture all manner of duplicates for the single photo file I upload into product posts. In and of itself, this is not an issue as much as being told a file is ‘unattached” and when I delete it permanently, I lose the product photo file.
I want to improve performance of my site. How do I search for legitimately unused photo files to delete?
]]>I recently moved a site to a new server and used the plugin Add From Server for the media library. It worked great but now I have a ton of images that show unattached.
Is there is a bulk way to search and reattach images so I can clean up the library from excess images that aren’t being used?
I hope this makes sense.
]]>Would love to see a resolution to @jrothra’s issue, I would say this is a valid concern and a fix would make WP a more robust CMS.
]]>