Automatically add alt tags to wordpress featured images

I was working on a site recently that had a few thousand images imported to wordpress after a drupal conversion, these images were set as the featured image for the imported posts. Because of the way the old site was constructed, these images had no meaningful names.

You can use the mysql query below to set the alt tags of your featured images to the name of the post.

This query assumes that no alt tag data currently exists, if you have existing alt tags, you will need to use an update query instead. Also note this only sets the alt data for images set as featured images for posts.

4 thoughts on “Automatically add alt tags to wordpress featured images

Leave a Reply to Sally Cancel reply

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