WP AI Alt Text Generator
WordPress plugin that uses AI (Claude) to generate alt text and descriptions for images on upload
by Your Name · github.com/ivdimova/wordpress-tdd-prototype · website
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/ivdimova/wordpress-tdd-prototype/archive/refs/heads/main.zipAutomatically generate accessible alt text and descriptions for uploaded images using AI vision technology powered by Anthropic Claude.
Description
WP AI Alt Text Generator enhances WordPress accessibility by automatically creating descriptive alt text for images as they're uploaded to your media library. Using advanced AI vision capabilities through the Model Context Protocol (MCP), this plugin helps content creators save time while improving website accessibility for screen reader users.
Features
- Automatic Alt Text Generation - Generate alt text automatically when images are uploaded
- Manual Generation - Add "Generate Alt Text" button to media library for existing images
- AI-Powered Descriptions - Create detailed image descriptions using Anthropic Claude Vision
- Smart Retry Logic - Automatic retries with exponential backoff for failed requests
- Secure API Key Storage - Encrypted storage of AI API keys
- WordPress Integration - Seamless integration with WordPress media library
- RESTful API - REST API endpoints for programmatic access
- Developer Friendly - Hooks and filters for customization
- Accessibility First - WCAG 2.1 AA compliant interface
Screenshots
- Settings page with API configuration
- Media library with "Generate Alt Text" button
- Automatic generation on image upload
- Generated alt text in attachment details
Installation
From ZIP File
- Download the plugin ZIP file
- Go to Plugins > Add New > Upload Plugin
- Choose the ZIP file and click Install Now
- Activate the plugin
- Navigate to Settings > AI Alt Text
- Enter your Anthropic API key and configure options
- Save settings
From Source
git clone https://github.com/yourusername/wp-ai-alt-text-generator.git
cd wp-ai-alt-text-generator
composer install --no-dev
npm install --production
npm run build
Configuration
Getting an API Key
- Visit Anthropic Console
- Sign up or log in to your account
- Generate a new API key
- Copy the key (it won't be shown again)
Plugin Settings
Navigate to Settings > AI Alt Text and configure:
- API Key - Your Anthropic API key (required)
- Auto Generate - Enable automatic generation on upload (default: enabled)
- Generate Descriptions - Create detailed descriptions along with alt text (default: enabled)
- Max Retries - Number of retry attempts for failed requests (default: 3)
- Timeout - API request timeout in seconds (default: 30)
Usage
Automatic Generation
- Ensure "Auto Generate" is enabled in settings
- Upload an image to your media library
- Alt text is automatically generated and saved
- View the generated alt text in attachment details
Manual Generation
- Navigate to your media library
- Click on an existing image
- Click the "Generate Alt Text" button
- Wait for generation to complete
- Alt text is updated automatically
For Developers
Filter alt text before saving:
add_filter( 'wp_ai_alt_text_before_save', function( $alt_text, $attachment_id ) {
// Customize alt text
return $alt_text . ' | Your Site Name';
}, 10, 2 );
Customize the AI prompt:
add_filter( 'wp_ai_alt_text_prompt', function( $prompt, $attachment_id ) {
return 'Generate alt text focusing on product features and benefits';
}, 10, 2 );
Conditional generation per image:
add_filter( 'wp_ai_alt_text_enabled_for_image', function( $enabled, $attachment_id ) {
// Only generate for images in 'product' post type
$parent = get_post( wp_get_post_parent_id( $attachment_id ) );
return $parent && $parent->post_type === 'product';
}, 10, 2 );
Requirements
- WordPress: 5.8 or higher
- PHP: 7.4 or higher
- MySQL: 5.7+ or MariaDB 10.3+
- API Key: Anthropic API key (required)
- Internet: Active connection for API calls
Frequently Asked Questions
How much does it cost to use?
The plugin itself is free, but you'll need an Anthropic API key. Anthropic charges approximately $0.006 per image (costs vary based on image size and API usage). See Anthropic Pricing for current rates.
Can I use this with other AI providers?
Currently, the plugin uses Anthropic Claude Vision. Support for additional providers (OpenAI, Google Vision) is planned for future releases.
Will this slow down my uploads?
Image processing adds 2-5 seconds per upload. For high-volume sites, consider using the manual generation feature instead of automatic generation.
Can I edit AI-generated alt text?
Yes! All generated alt text can be edited manually in the WordPress media library just like any other alt text.
Is my API key secure?
Yes. API keys are encrypted before storage in the WordPress database and never exposed to frontend JavaScript or browsers.
Does this work with existing images?
Yes. Use the "Generate Alt Text" button in the media library to generate alt text for images that were uploaded before the plugin was activated.
What image formats are supported?
JPEG, PNG, GIF, and WebP formats are supported. Maximum file size is 5MB (configurable).
Changelog
1.0.0 (2025-11-07)
- Initial release
- Automatic alt text generation on upload
- Manual generation button in media library
- Anthropic Claude Vision API integration
- Admin settings page
- REST API endpoints
- WordPress hooks and filters
- Comprehensive test suite (PHPUnit + Playwright)
- Full internationalization support
Upgrade Notice
1.0.0
Initial release of WP AI Alt Text Generator. Please configure your Anthropic API key in Settings > AI Alt Text after activation.
Support
Documentation
Getting Help
- GitHub Issues: Report bugs and request features
- WordPress.org Support: Community support forum
- Documentation: Comprehensive guides in
/documentationfolder
Contributing
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Development Setup
# Clone repository
git clone https://github.com/yourusername/wp-ai-alt-text-generator.git
cd wp-ai-alt-text-generator
# Install dependencies
composer install
npm install
# Run tests
./bin/install-wp-tests.sh wordpress_test root '' localhost latest
composer test
npm run test:e2e
# Code standards
composer phpcs
npm run lint
Testing
PHPUnit Tests
composer test # Run all tests
composer test:unit # Unit tests only
composer test:integration # Integration tests only
composer test:coverage # Generate coverage report
Playwright E2E Tests
npm run test:e2e # Run all E2E tests
npm run test:e2e:headed # Run with visible browser
npm run test:e2e:debug # Debug mode
npm run test:e2e:report # View test report
Privacy & Data
Data Collection
This plugin does not collect any user data. However, when generating alt text:
- Images are sent to Anthropic's API for analysis
- API calls are logged locally for debugging
- No data is stored by Anthropic beyond the API call
GDPR Compliance
- Users can disable automatic generation at any time
- API keys can be deleted from settings
- Plugin can be fully uninstalled, removing all data
Credits
Development
- Built with the AI Agent Orchestrator workflow
- Powered by Anthropic Claude for AI vision analysis
- Uses Model Context Protocol (MCP) for AI integration
Third-Party Services
- Anthropic Claude - AI vision analysis
- WordPress - Content management system
Special Thanks
- WordPress community for plugin development standards
- Anthropic for Claude Vision API
- All beta testers and contributors
License
This plugin is licensed under the GPL v2 or later.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
See LICENSE.txt for the full license text.
Author
Developed by Your Name
- Website: https://example.com
- GitHub: @yourusername
- Email: you@example.com
Plugin URI: https://github.com/yourusername/wp-ai-alt-text-generator Tags: accessibility, alt text, AI, image, media library, Anthropic, Claude Requires at least: WordPress 5.8 Tested up to: WordPress 6.4 Requires PHP: 7.4 Stable tag: 1.0.0 License: GPLv2 or later License URI: https://www.gnu.org/licenses/gpl-2.0.html