WP AI Alt Text Generator
WordPress plugin: bulk-generates WCAG-compliant alt text for Media Library images using Claude AI vision
by Bilal Mahmood · github.com/sahibbilal/wp-ai-alt-text · website
★ 0stars
0forks
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/sahibbilal/wp-ai-alt-text/archive/refs/heads/main.zipReadme
WP AI Alt Text Generator
Accessibility shouldn't be manual.
WP AI Alt Text Generator scans your WordPress Media Library, finds every image missing alt text, and generates accurate, WCAG-compliant descriptions using Claude AI vision — one click per image or all at once.
What It Does
- Dashboard under Media → AI Alt Text shows all images in a grid with coverage stats
- Missing / All / Has Alt Text filter tabs
- ✨ Generate button per image — Claude vision reads the image and writes descriptive alt text
- Auto-saves immediately after generation — no extra clicks
- ✨ Generate All Missing — processes every image without alt text sequentially with a live progress bar
- Editable — review and tweak before or after saving
- Coverage meter — shows % of images with alt text at a glance
How It Works
- Fetches the image from WordPress (via base64 encoding)
- Sends it to Claude Haiku's vision model with an accessibility-focused prompt
- Claude returns a concise alt text (max 120 characters), no "Image of" or "Photo of" prefix
- Saved to
_wp_attachment_image_alt— the standard WordPress alt text field used by all themes and Gutenberg
File Structure
wp-ai-alt-text/
├── wp-ai-alt-text.php # Bootstrap
├── includes/
│ ├── class-generator.php # Claude vision API + base64 fetch
│ └── class-admin.php # Media Library dashboard + AJAX handlers
├── assets/
│ ├── admin.css # Grid UI, cards, progress bar
│ └── admin.js # Generate, save, bulk loop with progress
└── README.md
Installation
- Upload the
wp-ai-alt-textfolder to/wp-content/plugins/ - Activate the plugin
- Go to Media → AI Alt Text
- Enter your Claude API key (from console.anthropic.com)
- Click ✨ Generate on any image, or Generate All Missing to bulk-process
API Cost
- Model:
claude-haiku-4-5with vision - ~$0.002 per image (input image tokens + short text output)
- 100 images ≈ $0.20
Part of the 30-Day WordPress AI Plugin Series
Day 4 of building one open-source WordPress + AI plugin every day.
- Day 1: WP RAG FAQ
- Day 2: WP Content Repurposer
- Day 3: WP Smart 404
- Day 4: WP AI Alt Text Generator ← you are here
Follow along: bilalmahmood.dev
License
GPLv2 or later