ASK DAVE TAYLOR

ASK DAVE TAYLOR

  • Home
  • Video Help
  • Latest Reviews
  • Most Popular
  • Top Categories
  • About Dave
  • Ask!
  • Home
  • / Wordpress Help
  • / Delete Unused Images from WordPress?

Delete Unused Images from WordPress?

 May 24, 2018 /  Dave Taylor /  Wordpress Help /  2 Comments

I’ve been running a WordPress blog for a long time. Is there a simple and reliable way to delete the unused images I’ve uploaded but then never actually included in a post?

You would like to think that there’s a simple checkbox on every image entry in the WordPress database that let it track whether the image, audio, video or similar had ever been added to a post or page. But there isn’t, though it seems like there is with “unattached”. Turns out that the way WordPress actually keeps track of what is and isn’t used is a bit Byzantine – and doesn’t work reliably at all.

Over on the WordPress forums, one helpful commentator explains unattached this way: “Media is only attached to a page or post when it is uploaded from the edit screen for that particular post or page. Adding to the media library from the Media section of the admin won’t attach it to the page.” Got it?

Yeah, me neither. In fact, it might require a bit of detective work on your part. One thing I do reliably is that when I upload an image it doesn’t get assigned a default alt attribute, but 100% of the time when I include an image in a blog post or page, I do give it an alt attribute. That gives me a pretty strong clue about what has or hasn’t been attached or embedded.

But let’s start at the top. Within WordPress, your Media Library will probably look like this:

wordpress media library Pin it! Share on Facebook

The selector along the top should be useful, right? I mean, there are all these choices:

wordpress media library selector filter

Choose “unattached” and you should get all the uploaded but unused images, right? Ah, if only.

wordpress unattached media library files images video audio Pin it! Share on Facebook

See that very first image with the beige boxes against the black background? A click and you can see a lot more details and information about an image that WordPress believes is unattached:

wordpress image - unattached - detail info view Pin it! Share on Facebook

WordPress thinks it’s unattached, but I’ve specified an Alt Text. Meaning, this particular image is actually in use. My naming scheme gives me another clue too: “-fp” means it’s a featured photo or image for an article. As you can see, WordPress is not being helpful here.

On the other hand, here’s another image that wasn’t flagged as unattached but, by my “did you add an alt attribute” test, isn’t included in any of my posts or pages:

wordpress unused unattached image Pin it! Share on Facebook

I do recall uploading this and I know that I didn’t use it in the post. So it’s safe to delete! That’s done by clicking on the red text link on the lower right “Delete Permanently“. A click and there’s a warning box…

wordpress delete image file video audio mp3 permanently Pin it! Share on Facebook

Yup, I can do this! A click on “OK” deletes the picture and keeps my WordPress database slim and uncluttered by unused image files. Now if only the “unattached” feature worked…

Pro Tip: We have lots of WordPress insider tips to help your site run smoothly! Check ’em out.

Let’s Stay In Touch!

Never miss a single article, review or tutorial here on AskDaveTaylor, sign up for my fun weekly newsletter!
Name: 
Your email address:*
Please enter all required fields
Correct invalid entries
No spam, ever. Promise. Powered by FeedBlitz
Please choose a color:
Starbucks coffee cup I do have a lot to say, and questions of my own for that matter, but first I'd like to say thank you, Dave, for all your helpful information by buying you a cup of coffee!
 delete files, delete images, delete photos, delete wordpress images, delete wordpress photo, wordpress file deletion, wordpress help

2 comments on “Delete Unused Images from WordPress?”

  1. Margaret Owens says:
    January 3, 2019 at 12:15 pm

    Did you find another way to discover what images aren’t being used, that everyone can use?

    Reply
    • Dave Taylor says:
      January 4, 2019 at 9:19 am

      Not as of yet. Hopefully with WP 5.0 being released we’ll get some smart plugin author to write something that can analyze your site? Or there are third party tools you might be able to utilize, but they tend to do the opposite: links that don’t properly resolve to images. A tricky problem, Margaret!

      Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

© 2018 by Dave Taylor. "Ask Dave Taylor®" is a registered trademark of Intuitive Systems, LLC.
Privacy Policy - Terms and Conditions

OVERWHELMED BY TECH?

You are not alone! Join our weekly newsletter to build up your confidence and capabilities in solving everyday technology problemss. Learn to master all your tech and gadgets!

“I love your newsletter. Keep up the very good work!”
– Julie Redd

“Thank you, Dave. I really do appreciate your updates.”
– Peter Kimball

Please wait...
Please enter all required fields Click to hide
Correct invalid entries Click to hide

 
  •  
  • More Info

    Search

    Recent Posts

    • How Can I Create an Email Filter Rule in Apple Mail?
    • How Can I find Royalty Free Photographs Online?
    • How Can I Work with Random Numbers in the Linux Shell?
    • How Can I Format a Table in Microsoft Word?
    • How Can I Add a Christmas Desktop Theme to my Windows PC?

    On Our YouTube Channel

    Vizio 36" Home Theater Soundbar with Dolby ATMOS - SB-36514-G6 - INSTALL & REVIEW

    Categories

    • AdSense, AdWords and PPC Help (106)
    • Amazon Echo & Kindle Help (74)
    • Android Help (136)
    • Apple Watch Help (47)
    • Articles, Tutorials and Reviews (322)
    • Business Advice (182)
    • Computer and Internet Basics (687)
    • d) None of the Above (158)
    • eBay, Amazon and Online Shopping Help (150)
    • Facebook Help (343)
    • Gmail Tips & Help (119)
    • Google Plus Support (59)
    • HTML and Web Design (238)
    • Instagram Help (40)
    • iPad Help (129)
    • iPhone Help (542)
    • iPod and MP3 Player Help (181)
    • LinkedIn Help (72)
    • Linux Help (137)
    • Linux Shell Script Programming (86)
    • MacOS X Help (780)
    • Most Popular (5)
    • Pinterest Help (51)
    • SEO Tips and Tricks (78)
    • Trade Show Updates (23)
    • Twitter Help (205)
    • Video Game Tips and Reviews (66)
    • Web Site Traffic Tips (61)
    • Windows Help (749)
    • Wordpress Help (197)
    • Writing and Publishing (70)
    • YouTube Help (40)
    • YouTube Video Reviews (159)

    Archives

    Social Connections:

    Ask Dave Taylor


    Follow Me on Pinterest
    Follow me on Twitter
    Follow me on LinkedIn
    Follow me on Instagram


    AskDaveTaylor on Facebook



    microsoft insider mvp


  •  
  • Popular Pages

    • Home
  • Stay In Touch

    • Twitter
    • Facebook
 
© askdavetaylor.com. All rights reserved.
  • Privacy Policy