This WordPress plugin allows you to automatically generate an Alt Text for images uploaded into the media library. This plugin is able to use the AI of external services of OpenaAI or Azure to generate an alt text that is as faithful as possible to the content of the image.
This plugin allows you to generate alt texts in the following ways:
- using Openai APIs (GPT-5, GPT-5 mini, GPT-5 nano, GPT-4o, GPT-4o Mini, o1 Mini)
- using Claude Anthropic APIs
- using Azure APIs for computational vision;
- recovering the title of the image
- recovering the title of the article in which the image is uploaded
Please ensure you have the following tools installed:
- PHP version: >= 7.4
- composer
- node version: 18
- npm
Within your WordPress installation, navigate to the plugin directory and run the following commands:
git clone git@github.com:valeriomonti/auto-alt-text.git
cd auto-alt-text
composer install
npm install
npm run buildIn the wp-admin panel activate the Auto Alt Text plugin.
The plugin settings are found in the Settings -> Auto Alt Text Options menu.
After installing the plugin, click on the 'Auto Alt Text' menu item and select the Generation Method you prefer.
In your OpenAI account, retrieve the following data to enter on the options page:
- API Key
Choose the model you want to use for generating the alt text. Enter a prompt for generating the alt text according to your needs.
In your Anthropic account, retrieve the following data to enter on the options page:
- API Key
Choose the model you want to use for generating the alt text. Enter a prompt for generating the alt text according to your needs.
On your Azure account, create a Computer Vision instance and retrieve the following data to enter on the options page:
- Computer Vision API Key
- Computer Vision Endpoint
If you want to generate an alt text in English, save the options without filling in any other fields.
If you want to generate an alt text in a different language, on your Azure account, create a Translator instance and retrieve the following data to enter on the options page:
- Translator Instance API Key
- Translator Instance Endpoint
- Translator Instance Region
After entering this data, save the options.
Select the desired language and save the options again.
For this generation method, there are no options to set as the alt text will be generated by copying the title of the article in which the image is uploaded.
In case the article is not uploaded as an attachment of an article, the "Title of the attachment" method will be used as a fallback.
For this generation method, there are no options to set as the alt text will be generated by copying the title of the image.
Once the plugin is configured, each time an image is uploaded to the media library, an alt text will be automatically set based on the selected generation method.
For images already in the media library, you can create bulk alt texts. Open the Media Library in the "list" view, select the images for which to generate the alt text, and choose the "Generate alt text" bulk action. (Depending on the number of images chosen and their weight, this may take some time.)
You can also generate the alt text of a single image directly from the media library. Open the Media Library in “grid” mode, choose the image for which to generate the alt text, and click the “Generate alt text” button. In no time the alt text field will be overwritten by the generated description.
If you prefer generating alt text in batch (e.g., to avoid slow/error-prone processing in the Media Library UI), you can use WP-CLI.
Generate alt text for a list of attachment IDs:
wp auto-alt-text generate --ids=123,456,789Process all image attachments in batches:
wp auto-alt-text generate --all --limit=200 --offset=0
wp auto-alt-text generate --all --limit=200 --offset=200Dry run (no metadata updates):
wp auto-alt-text generate --ids=123,456 --dry-runForce overwrite of existing alt text (even if “Keep existing alt text” is enabled):
wp auto-alt-text generate --all --limit=200 --offset=0 --forceNotice: If you choose one of the methods that involves the use of external APIs, the upload times for images in the media library might increase because it requires sending a request to the APIs, waiting for the external server to process, and waiting for a response.
In case of an error in the API call, the image will still be uploaded but without alt text as usual. In this case, the cause of the error can be seen on the Auto Alt Text -> Error log page.
If the generation of the alt text via AI is set, in case of errors, to avoid blocking the editorial work, the image is loaded anyway but without the alt text being compiled.
When a call to the Azure or OpenAI API fails, a record containing the error message is saved in a custom database table. In this case, the cause of the error can be seen on the Auto Alt Text -> Error log page.
We strongly recommend defining the new plugin-specific constants in your wp-config.php:
define( 'AAT_ENCRYPTION_KEY', 'a_random_string_of_at_least_64_characters' );
define( 'AAT_ENCRYPTION_SALT', 'another_random_string_of_at_least_64_characters' );
You will find these two define(...) lines already generated for you on the Auto Alt Text » Options page – simply copy & paste them before the /* That's all, stop editing! Happy publishing. */ line in your wp-config.php.
If you choose not to add them, the plugin will continue to work normally, but it will fall back to using your WordPress LOGGED_IN_KEY / LOGGED_IN_SALT, which may break if those salts are ever changed.