Generate missing WordPress image alt text with OpenAI vision

Go to Workflow
0 views
Built by Bincy Bhanu. S Bincy Bhanu. S
Created on October 16, 2026

Description

Quick overview
This workflow runs manually or every Monday at 9am, finds WordPress media library images missing alt text, generates concise descriptions with the OpenAI Chat Completions API using vision, validates the results, and optionally writes the alt text back to WordPress via the REST API.

How it works
Runs either manually or on a weekly schedule (Monday at 9am).
Fetches the most recent image attachments from the WordPress REST API media endpoint.
Filters to images with no existing alt text, limits the run to supported formats (JPEG/PNG/WebP), and selects a suitable image URL for each item.
Sends each image URL (and optional title context) to the OpenAI Chat Completions API to generate alt text in the configured language and maximum length.
Validates and normalizes the returned alt text (JSON parsing, removes “Image of…”-style prefixes, enforces max length) and marks items as ready or skipped.
If dry run is enabled, outputs the proposed alt text; otherwise, updates the WordPress media item’s alt_text field via the WordPress REST API.

Setup
Create a WordPress Application Password for a user with permission to edit media, and add it to an n8n HTTP Basic Auth credential used by the WordPress API requests.
Add an OpenAI API credential for the OpenAI Chat Completions request.
In the Config step, set your WordPress siteUrl, choose the OpenAI model, language, limits (images to scan and max per run), and the maxAltLength value.
Run once with dryRun set to true to review proposed alt text, then set dryRun to false to enable updates.
Ensure your WordPress image URLs are publicly accessible so OpenAI can fetch the images from source_url.

This workflow was created by Bincy Bhanu. S and shared publicly on the n8n community template library. n8nFind indexes it for discovery — the workflow remains the property of its original creator.

Nodes Used (2)

Code
n8n-nodes-base.code
HTTP Request
n8n-nodes-base.httpRequest