WordPress image accessibility and SEO

Write alt text for every image without writing it yourself

Set up an AI alt text generator WordPress media libraries can use directly: one click per image, or a bulk pass across everything still missing alt text, powered by OpenAI or Gemini with your own API key.

  • 12 models across OpenAI and Google Gemini.
  • "Generate with AI" right inside the Media Library, no extra screen.
  • Bulk-generate for every image still missing alt text.
  • Rate-limited, cached, and retried automatically on failure.
AI Alt Text GeneratorMedia Library
Alt TextGolden retriever puppy running across a grass field at sunset.Generate with AI
Bulk generate58 images missing alt text
142 / 200
Alt text generatedOpenAI or Gemini, cached for 24 hours per image.
Done
Quick answer

AI alt text generator WordPress: what does the module actually do?

This is what an AI alt text generator WordPress sites get with TheOneWP: TOWP_Ai_Alt_Text adds a "Generate with AI" button directly into the Media Library — grid view, list view, the insert-media modal and the attachment edit screen — that downloads the image, sends it to OpenAI or Gemini as base64 data with a fixed accessibility-minded prompt, and writes the result into the image's standard alt text field. A Bulk Generate mode works through every image still missing alt text one at a time, respecting a configurable per-user rate limit, a 24-hour result cache, and an automatic retry on transient failures.

The missing-alt-text problem

Most media libraries have hundreds of empty alt fields

Alt text is easy to skip when uploading one image at a time, and on an established site the backlog of images with no alt text at all can run into the hundreds.

Screen reader users get nothing where an image should be described

An empty alt attribute means a screen reader either skips the image entirely or reads the raw file name — neither tells a visitor what is actually there.

Writing hundreds of descriptions by hand does not happen

Going back through an existing media library and writing alt text for every image manually is exactly the kind of task that gets postponed indefinitely.

A unified WordPress solution

A description generated where you already work

The button lives in the Media Library itself, and the same engine that handles one image can work through an entire backlog.

One click, right where alt text is edited

The "Generate with AI" button appears next to the alt text field itself, in every view that field appears in.

Bulk Generate for the existing backlog

Works through every image missing alt text automatically, one at a time, until the list is clear.

Built to survive a large library

Rate limiting, caching and automatic retries mean generating for hundreds of images does not mean hundreds of avoidable API calls or failures.

Verified feature set

The complete AI alt text generator WordPress feature set

Every capability below is present in the class, its AJAX handlers, or the inline media library script.

Integration

Injected into every alt-text field

Grid view, list view, the media modal and the attachment edit screen all get the same button, via one inline admin_footer script.

4 contextsNo separate asset file
Bulk

Bulk Generate for the whole backlog

Finds every image missing alt text via a real query, then processes them one at a time through the same AJAX endpoint.

towp_ai_bulk_nexttowp_ai_bulk_count
Automation

Optional generate-on-upload

New images can get alt text automatically the moment they are added to the library, without a manual click at all.

add_attachment hookOptional
Reliability

Caching and automatic retry

Results are cached for 24 hours per image/model/language, and a transient failure gets one automatic retry after a 2-second pause.

24h cache1 retry
Control

Overwrite protection and rate limiting

Existing alt text is preserved unless you explicitly allow overwriting, and a configurable per-user rate limit keeps usage predictable.

Overwrite toggleConfigurable RPM
Recommended workflow

Set up an AI alt text generator WordPress library in four steps

Get one image working correctly before running it across the whole library.

01

Add your API key and pick a model

Choose OpenAI or Gemini and the specific model, then save your key — it is encrypted before storage.

02

Generate one image to confirm it works

Click "Generate with AI" on a single image and check the result before relying on it at scale.

03

Run Bulk Generate for the existing backlog

Let it work through every image still missing alt text, respecting the configured rate limit automatically.

04

Turn on generate-on-upload for new images

Once you trust the results, enable it so every future upload gets alt text without a manual step.

Practical use cases

Where generated alt text saves real time

The module fits any site with more images than time to describe them by hand.

Clearing an existing accessibility backlog

A media library with years of uploads and no alt text becomes a single Bulk Generate pass instead of a manual audit.

High-volume publishers and blogs

Generate-on-upload means every new image gets a description automatically, without adding a step to the editorial workflow.

Multilingual sites

Set the output language per site, or regenerate a set of images in a different language when needed.

Operational benefits

Built to be used at real media-library scale

Every design choice in the verified code favors surviving hundreds of images over working for a demo of three.

Rate-limited by designA configurable per-user cap keeps a bulk run from generating an unexpected API bill.
Does not regenerate needlesslyA 24-hour cache means asking twice for the same image does not mean paying twice.
Recovers from a flaky response on its ownOne automatic retry handles the transient failures that happen at real scale.
Accessibility-minded prompt by defaultThe instruction explicitly avoids "Image of" and "Photo of" openers, which screen readers do not need.
Performance behaviour

No wasted calls, no runaway usage

The verified implementation treats every AI call as something worth avoiding when it can be.

24-hour result cache

Keyed by model, image URL and language, so identical requests within a day are served from the cache, not the API.

Configurable requests-per-minute cap

A rolling 60-second transient counter enforces the limit per user, with super admins exempt by default.

No dedicated CSS or JS file

The Media Library button and its styling are printed inline via admin_footer, only when the module is enabled — nothing extra to enqueue.

Security implementation

An encrypted key, a capability check on every call

The code treats the API key as a secret and every generation request as something to authorize first.

01

Encrypted API key storage

The key is decrypted with TOWP_FTP_Volume::decrypt() only at the moment a request is made — the same encryption used for other API keys across the plugin.

02

upload_files capability required

Every generation request — single or bulk — checks this capability before doing anything, alongside a verified nonce.

03

MIME type and size enforcement

Only JPEG, PNG, GIF and WebP under 5 MB are accepted; anything else is rejected before it is ever sent to an AI provider.

04

Structured failure logging

A retried or failed request logs the host and HTTP status code in a consistent format, without logging the image content or the API key.

Verified compatibility

Works with the alt text field WordPress already has

The supplied code writes to core's own attachment meta rather than a separate, plugin-specific field. No compatibility claim beyond the verified implementation is assumed.

Core meta

_wp_attachment_image_alt

The exact meta key WordPress core uses for alt text — any theme, block or plugin reading it sees the generated result with no extra integration.

Core fieldNo custom meta
Upload hook

add_attachment

The generate-on-upload option hooks the same action WordPress fires for every new attachment, regardless of how it was uploaded.

Core hookOptional
Encryption

TOWP_FTP_Volume

The same encryption helper other TheOneWP modules use for stored API keys and secrets.

Shared helperAES-256-GCM
Solution comparison

TheOneWP versus common alternatives

Compare a real AI alt text generator WordPress implementation with typical dedicated alt-text plugins or manual entry.

CapabilityTheOneWP AI Alt Text GeneratorOther common solutions
Provider choice 12 models across OpenAI and Gemini, your own API keyOften locked to a single provider or a hosted service
Where it lives Inline in the Media Library, every viewSometimes a separate screen or bulk-only tool
Existing backlog Bulk Generate finds and processes every missing imageManual selection is often required first
Cost control Rate limiting and a 24-hour cache built inVaries; some tools have no request cap at all
Reliability Automatic retry on transient failuresA failed request often just fails, with no retry
Administration One TheOneWP settings panelMay require a separate plugin and its own account
Best practices

Get descriptions worth keeping

A few habits keep generated alt text genuinely useful.

01

Spot-check before a big bulk run

Generate a handful of representative images first so a wrong assumption does not repeat across hundreds of files.

02

Set the output language deliberately

Match it to the site's actual content language rather than leaving the default in place by accident.

03

Leave overwrite off unless you mean it

Existing hand-written alt text is often more accurate than a generated guess — protect it by default.

04

Review purely decorative images separately

An image that should have empty alt text (decorative only) is a case the generator was not built to detect on its own.

Common mistakes

Avoid assumptions the code does not support

The module has a defined, verified scope — a few assumptions outside it cause confusion.

Expecting it to work without an API key

generate_alt_text() returns an error immediately if no key is configured — there is no built-in AI service, only your own OpenAI or Gemini account.

Uploading images well over 5 MB and expecting them to process

Anything larger than 5 MB, or outside JPEG/PNG/GIF/WebP, is rejected before an API call is even attempted.

Running a huge bulk pass with a low rate limit and expecting it instantly

The configured requests-per-minute cap applies to bulk generation too — a low limit on a large library means a slower, not a blocked, run.

Frequently asked questions

AI Alt Text Generator FAQ

These answers come directly from the verified class and its AJAX handlers.

Which AI providers does it support?

OpenAI and Google Gemini, across 12 selectable models total: nine OpenAI models from GPT-4.1-nano up to GPT-5.1, and three Gemini models from 2.0 Flash up to 2.5 Pro.

Does it send my image URL to the AI, or the actual image?

The actual image. The module downloads the file itself and sends it as base64-encoded data — deliberately, since an AI provider cannot reach a local domain or a private network, and a URL alone would fail on staging sites.

Is there a size or file type limit?

Yes. Images are capped at 5 MB, and only JPEG, PNG, GIF and WebP are accepted — anything else, or anything larger, returns a clear error instead of a failed silent request.

Does it overwrite alt text that already exists?

Only if you turn on "Overwrite existing alt text." By default, an image that already has alt text is left alone, whether generated one at a time or through Bulk Generate.

What stops someone from generating hundreds of images per minute and running up an API bill?

A per-user rate limit, configurable in requests per minute, enforced with a rolling 60-second transient counter. Super admins bypass it by default, but that bypass itself is filterable.

Does it regenerate the same alt text every time I ask?

No, not within 24 hours. Each result is cached in a transient keyed by the model, the image URL and the output language, so asking again for the same image, model and language returns the cached text instead of another API call.

What happens if the AI request fails?

It retries once automatically, after a 2-second pause, for connection errors or 429/500/502/503/504 responses — and logs both the initial and, if it happens, the final failure with the host and status code for debugging.

Can the alt text be written in a language other than English?

Yes. The output language is a setting, and the same instruction is sent to whichever provider is configured, so both OpenAI and Gemini honor it identically.

Stop leaving alt text blank.Generate it where you already upload.

Use an AI alt text generator WordPress media libraries can lean on: your own API key, a real rate limit, and a button right next to the field it fills in.