WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there an (easy) way to check if all my images are in the database?

I want to check my upload folder to see if each file has an 'attachment' record in the wp_posts table. I know of the extra images WP creates.

After a few migrations I'm afraid I got to much overhead, I want to check this

share|improve this question

Every time you upload an image, WordPress automatically create duplicate copies of that image and re-size them to thumbnail and medium size. Most of the time, these images are not used. In addition, there could also be some images that you have uploaded, but did not use them in the post. These unused images could easily add up to a massive size and cause unnecessarily burden to the server and database.

The DUI (Delete Unused Images) plugin scans your WordPress blog and find those images that are not used or referenced to by any of the posts/pages. It then proceeds to delete them from the database/server.

To use the plugin, you have use a FTP program to chmod the Uploads folder (the folder where images are stored) to 777. Once you have deleted the unused images, chmod the folder back to 755 again to prevent access from other people.

Similarly, you should run this plugin every few months to clear up your database.

Delete Unused Image files plugin for wordpress

Note: Unsure if this works with most recent version of WordPress. However, it is an option and worth trying.

share|improve this answer
sounds like what I need I'll look into it on mondag. I'll get back at you. – janw May 17 '12 at 7:58

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.