Updating Alt Text in WordPress Media Library Does Not Update Images in Posts

Updating Alt Text in WordPress Media Library Does Not Update Images in Posts Featured Image

I’ve been using WordPress as my primary blogging platform since late 2016. In that time, I’ve learned a lot of things about WordPress and how it’s used. What I didn’t expect was to discover some of it’s fundamental flaws. Today, I want to talk about one of those flaws related to the media library.

Table of Contents

What Is The Media Library?

If you’re not super familiar with WordPress, don’t worry! I’ll quickly explain some of the jargon.

So, the media library is this space in WordPress where you store all of your images and other attachments like videos and PDFs. At the time of writing, my media library contains 1,688 items.

I’m not totally sure how the images are stored under the hood, but I imagine they’re placed in folders by date. For example, here’s the path for a recent file:

/wp-content/uploads/2022/06/why-dont-we-index-from-one-in-computer-science-v2-3-4.jpg

Now, all of the metadata associated with that file is stored somewhere. I suspect it’s the database, but I haven’t done a lot of digging.

Regardless, that metadata is important because it includes information like the title, caption, description, and alt text for every piece of media. You can click on any item in the media library and update those elements directly. Pretty nice, huh? That’s what I thought!

The Problem With the Media Library

My usual writing workflow is to draft up some text and drag-and-drop images as needed. When you do this, the images are uploaded automatically to the media library with some generic title based on the file name. Once I’m done writing, I usually go back to the media library an update the title and alt text manually.

Unfortunately, any changes to the media library will not automatically populate in any of the posts. Yes, you read that correctly. If you make changes in the media library, they do not propagate to images embedded in posts.

A lot of folks seem to think this behavior is okay given that you might want different alt text for the same image on different pages. To that I say, provide the ability to override the media library on a post-by-post basis. Otherwise, default to whatever is in the media library.

The fact that I’m just finding out about this over five years into writing is partially embarrassing for me but also embarrassing for WordPress. As a result, I’ve had hundreds of images across that site that don’t pass the most basic of accessibility checks. That’s not okay.

How to Update Existing Images to Match the Media Library

Initially, I tried to dig up an plugin that could overwrite existing images in posts with the alt text that is the media library, but I had no luck. It seems the handful of plugins that can do this are either premium and/or buried under incomprehensible documentation.

As a result, I resorted to a plugin that identifies images that don’t have alt text for me. That way, I could go into their respective posts and replace the images. For anyone asking, the plugin is called Alt CheckerOpens in a new tab. by Aaron Oscvari, and it’s a pretty nice tool. Basically, it lists out all of the images that are missing alt text with a link to the post.

To fix the actual alt text, you have to go into the post and click on the image in question. In the side bar, you should see an empty alt text section. Ignore that! Click on the image instead and look for the text above that says “replace”. This will launch the media library which will bring you directly to the image that’s already in the post. From here, you can click “select”, and the same image with be replaced—this time with the correct alt text.

This can be somewhat of a painful manual process, but I enjoyed it. Ultimately, I was able to work through old posts to remove junk. I imagine my website will be shooting up in SEO shortly.

With that said, that’s all I have for you! If you liked this and want to read more like it, check out some of these related articles:

Otherwise, take care of yourself! See you next time.

Jeremy Grifski

Jeremy grew up in a small town where he enjoyed playing soccer and video games, practicing taekwondo, and trading Pokémon cards. Once out of the nest, he pursued a Bachelors in Computer Engineering with a minor in Game Design. After college, he spent about two years writing software for a major engineering company. Then, he earned a master's in Computer Science and Engineering. Today, he pursues a PhD in Engineering Education in order to ultimately land a teaching gig. In his spare time, Jeremy enjoys spending time with his wife, playing Overwatch and Phantasy Star Online 2, practicing trombone, watching Penguins hockey, and traveling the world.

Recent Meta Posts