WOLF - WordPress Posts Bulk Editor and Manager Professional

How to Bulk Edit Image Alt Text in WordPress (From the Image Title)

To bulk edit image alt text in WordPress, you work on the images themselves, not on the posts that show them. Every image in the Media Library keeps its alternative text in a meta field of its own. WOLF can load the Media Library as a table, add that field as a column, find the images that have no alt text and fill them all in one operation, for example by copying each image's title into its alt text.

Where WordPress stores alt text

Every uploaded file is a post of the type attachment. Its Title is the post title, its Caption is the excerpt and its Description is the content. The Alternative Text field of the Media Library is saved as post meta with the key _wp_attachment_image_alt on that attachment. That is why a bulk editor that only shows your posts cannot change alt text: the value belongs to the image.

Where the stored value is used matters for what a bulk change will fix:

  • Read at page load: featured images, galleries, WooCommerce product images and most theme output go through wp_get_attachment_image(), which takes the alt text from the attachment every time the page is built. These images show the new alt text immediately.
  • Copied into the post: an image inserted into the content with the Image block or the classic editor carries a copy of the alt text in the post's HTML, written at the moment of insertion. Changing the Media Library value does not update those copies. Edit them in the post itself.

Set up WOLF for images

  1. In the post type selector on the tools panel of the Posts Editor, choose attachment. The page reloads with the files of the Media Library.
  2. Open the Meta Fields tab. Under Add Custom key by hands, add _wp_attachment_image_alt. Give it the title "Alt text", keep the view textinput and the type string, and click Save meta fields. You can also type the ID of an image that already has alt text under Get meta keys from any post by its ID and keep only that key.
  3. Open the Settings tab, enable the new "Alt text" column and click Save all settings. Enable the Title column too, so you can compare both. The field shows up in the Filters and Bulk Edit tabs only once its column is active.

If Separate columns and meta for post types is set to Yes in the Settings tab, each post type has its own meta fields and columns. Then add the key while attachment is the selected post type.

Find images without alt text

In the Filters tab, the "Alt text" field now has its own text filter. Set its behaviour to Empty and click Filter. This finds images whose alt text was cleared and also images that never had the field at all, which is the case for most uploads nobody described.

Narrow the result with the other filters:

  • Post mime type, for example image/jpeg, leaves out PDFs, audio and video, which do not need alt text. It takes one type at a time, so run image/png and image/webp afterwards.
  • Post parent from and Post parent to, both set to one post ID, keep only the images uploaded to that post or page. Images that are not attached to anything have the parent 0. The FAQ on attaching and detaching media explains this field.
  • The title filter with BEGIN and img_ or dsc finds camera file names, which need a description written by hand.
  • Date Published from and to limit the result to the images uploaded in a period.

A combination you will use again, such as "JPEG images without alt text", can be saved with the Filters profiles button on the tools panel.

Copy the image title into the alt text

Look at the titles before you copy them. WordPress builds the title of an upload from its file name unless the file carries a title of its own, so many titles read blue-shirt-front or IMG_2041. Hyphenated titles are easy to clean first: in the Bulk Edit tab, enable title, choose replace, type - as the text to find and a space as the replace to text. This also splits real hyphens such as "T-shirt", so look through the titles first. Camera names should be described by hand, because "IMG_2041" as alt text is no better than none. The bulk search and replace guide covers the replace behaviour in detail.

Then fill the alt text:

  1. Keep the filter from the previous step, open the Bulk Edit tab and check the notice Bulk editing will be applied to:. It should say the filtered [attachment] posts or your selection.
  2. Tick the "Alt text" field, set its behaviour to new.
  3. Choose TITLE in its variable drop-down. {TITLE} appears in the input.
  4. Click Do Bulk Edit and confirm.

WOLF replaces {TITLE} with the title of each image, so every image gets its own alt text. The variable can be part of a longer text. For a set of images from one place or one product line, a value such as {TITLE}, Aurora hotel lobby adds context that is true for each of them.

The other behaviours work on the existing value: append adds text at the end, prepend at the beginning, and replace swaps one word for another in every alt text, for example after a product was renamed. On images that have no alt text yet, append and prepend write only the added text.

For a single image, click its "Alt text" cell in the Posts Editor and type the text. To give several selected images one identical alt text, use binded editing.

Captions, descriptions and titles in the same table

The other texts of an image are core fields and need no meta setup. Enable their columns in the Settings tab:

Media Library fieldWOLF columnBulk Edit field
TitleTitletitle
CaptionExcerptexcerpt
DescriptionContentcontent
Alternative Textyour _wp_attachment_image_alt columnthe same meta field

The same behaviours and variables apply, so excerpt set to new with {TITLE} gives every image a caption from its title. WordPress does not print the attachment title on the page by default, so visitors and search engines get the alt text and, where the theme shows it, the caption. For the technical data of a file (sizes, dimensions) see editing attachment metadata.

Write useful alt text, then check and undo

  • Alt text is read aloud by screen readers and shown when an image cannot load. Describe what the image shows or does in a short phrase.
  • Purely decorative images should keep an empty alt text, so leave them out of the filter.
  • Do not put the same keyword into every image. A keyword appended to thousands of images is noise, not description.
  • Check the result on a page with a featured image: view the page source and find the alt="..." of the image. Clear page caches if the old value still shows.
  • Every bulk run is recorded in the History tab and can be reverted as a whole or image by image.

If the "Alt text" field does not appear in the Filters or Bulk Edit tab, check that its column is active in the Settings tab for the attachment post type. If that does not help, ask on the WOLF support forum.