Generate AI alt text for your WordPress media library
Published Updated 3 min read
WordPress does not write alt text when you upload an image. You type it yourself or leave the field empty, and usually it stays empty. A travel photographer back from a weekend with fifty photos is not writing fifty captions before publishing, and neither is a shop owner adding product shots one at a time. Over months the library fills with images search engines cannot read and screen readers cannot describe.
Describing an image with AI now costs a fraction of a cent per call. Plugins do it, but their free tiers are thin, typically twenty images a day, one at a time. With your own OpenAI key the cap disappears: send each image URL to the Vision API, get a short description back, and write it to WordPress's standard alt text field. That is all this plugin does.
Why missing alt text compounds over time
Search engines cannot see images. They read the alt text, the filename and the copy around it. A library of DSC_4829.jpg files with empty alt text adds nothing to image search and weakens the relevance of every page those images sit on.
Screen readers read alt text aloud, and an image without it is announced as a blank or skipped. WordPress has no bulk alt text editor, so clearing a backlog means opening each attachment, typing a description and saving. That is the job this replaces.
The middle layer behind the daily cap
Most AI alt text tools for WordPress call the vendor's own API rather than OpenAI directly. That middle layer is how the vendor controls cost, and why free tiers stop at around twenty images a day. A site with five hundred photos waits more than three weeks.
With your own key the middle layer goes. The plugin reads the image URL, sends it to OpenAI and writes the answer to the database: no account to create, no daily reset, and no images passing through a third party.
A table, a Bulk Generate button and a skip rule
Settings > AI Alt Text takes your OpenAI key and a model. gpt-4o-mini does this job well and costs less per call than gpt-4o, since the prompt is short and the answer is one sentence.
Media > AI Alt Text lists every image in the library, already-uploaded ones and WooCommerce product images included, with its current alt text and a Generate button. Bulk Generate at the top works through them in sequence over AJAX with a progress bar; several hundred images take a few minutes. Images that already have alt text are skipped by default so hand-written captions survive; untick that setting to overwrite everything.
Each attachment's edit screen also gets a Generate AI Alt Text button for refreshing one image. Results go into the standard _wp_attachment_image_alt field, which every theme and SEO plugin reads.
Upload-time captions, many sites, many languages
Generation here is on demand. If every new upload should get alt text automatically, some managed services already hook the upload; a follow-up message can add the same hook to this build.
If you run several sites, want brand-specific wording, or need alt text in several languages, a platform with central configuration handles that better than a plugin per site. For one site with a backlog of untagged images, your own key is the cheaper and faster route.
What you get
Included
- Bulk-generate alt text for all images in the media library that have none
- Single-image generation from the attachment edit screen
- Admin settings for API key, model choice, and the skip rule for existing alt text
- Output stored in the standard WordPress alt text field, compatible with all themes and SEO plugins
Not included
- Automatic alt text generation on image upload
- Alt text for PDFs, audio files, or video attachments
- Translation of generated alt text into multiple languages
- Rewriting or improving alt text that already exists
Alt Text AI does the things on the right. This build covers the part most sites use.
Questions
What does each API call cost?
gpt-4o-mini is one of OpenAI's cheapest vision models, and a typical description costs a fraction of a cent. A 500-image library costs a few dollars at most, and you only pay when you generate or regenerate, never on page loads.
Build it in Steem
The button opens the builder with this guide's prompt filled in, so you can change anything before it runs. Nothing is built, and nothing is charged, until you send it.
Read the prompt (200 words)
Build a WordPress plugin that generates alt text for media library images using the OpenAI Vision API. Add a settings page under Settings > AI Alt Text with three fields: an OpenAI API key, a model selector with options gpt-4o-mini and gpt-4o, and a checkbox labelled Skip images that already have alt text (checked by default). Add an admin page called AI Alt Text under the Media menu that shows a table of all image attachments with columns for thumbnail, filename, current alt text (shown as a dash if empty), and a Generate button per row. Include a Bulk Generate button at the top that processes all images matching the skip rule via AJAX with a progress bar. When generating for an image, send the attachment URL to the OpenAI Chat Completions API using a user message with an image_url content part and a text prompt asking for concise descriptive alt text under 125 characters suitable for screen readers, then save the response to the _wp_attachment_image_alt post meta field. On the individual attachment edit screen in wp-admin, add a Generate AI Alt Text button below the alt text field that triggers the same process for that single image via AJAX.
Steem