Home > Software design >  Remove URLs from image alt text in Wordpress
Remove URLs from image alt text in Wordpress

Time:07-08

i have a WP installation that lots of image alt text contain the URL of the image. Like:

<img alt="https://example.com" src="https://example.com" />

This ends up Ahrefs displaying those Alt texts are missing.

I would like to batch edit the alt text to reflect let's say the name of the file or totally remove those alt texts.

I have tried Media Library assistant Plugin but it didn't work out. I have also run a Better Search and Replace Plugin query but it didn't work either.

Added info: I found an image that in the media library the Alt text appears properly (into-background). I also checked the wp_postmeta table, found the alt text field and it displays the same as the Media Librady (into-background). However when i inspect the image in the browser it gives me the URL inside the Alt text.
enter image description here

CodePudding user response:

Wordpress saves alt text inside the wp_postmeta table, just search for one of your media post ID and look for the _wp_attachment_image_alt post meta key.

You will find your alt text there. If you want to simply remove ALL of them you may try with a simple REPLACE made in mysql, watch out with the conditions, if you have no problem in emptying all of them it's easier, if you want to save some, then add a WHERE condition accordingly

  • Related