PHPackages                             soderlind/ai-alt-text - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Image &amp; Media](/categories/media)
4. /
5. soderlind/ai-alt-text

ActiveWordpress-plugin[Image &amp; Media](/categories/media)

soderlind/ai-alt-text
=====================

AI Alt Text – Automatically generate alt text for images using AI. Supports OpenAI, Claude, Gemini, Ollama, and Grok.

1.0.3(5mo ago)10[13 PRs](https://github.com/soderlind/ai-alt-text/pulls)GPL-2.0-or-laterPHPPHP ^8.3CI failing

Since Nov 27Pushed 1mo agoCompare

[ Source](https://github.com/soderlind/ai-alt-text)[ Packagist](https://packagist.org/packages/soderlind/ai-alt-text)[ Fund](https://paypal.me/PerSoderlind)[ RSS](/packages/soderlind-ai-alt-text/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (4)Dependencies (3)Versions (20)Used By (0)

AI Alt Text
===========

[](#ai-alt-text)

Generate alt text for images using AI. Supports multiple AI providers including OpenAI, Claude, Gemini, Ollama, Azure OpenAI, and Grok.

[![AI Alt Text Plugin Screenshot](assets/bug.png)](assets/bug.png)

Features
--------

[](#features)

- **Bulk Update**: Update alt text for multiple images at once from the media library
- **Block Editor Integration**: Generate alt text directly from the image block in the editor
- **Multiple AI Providers**: Choose from OpenAI (GPT-4o), Anthropic Claude, Google Gemini, Azure OpenAI, Ollama (local), or Grok
- **Language Detection**: Automatically uses WordPress language settings for generated alt text
- **Flexible Configuration**: Configure via constants, environment variables, or the admin settings page

Requirements
------------

[](#requirements)

- WordPress 6.8 or higher
- PHP 8.3 or higher
- API key for your chosen AI provider (except Ollama which runs locally)

Installation
------------

[](#installation)

- **Quick Install**

    - Download [`ai-alt-text.zip`](https://github.com/soderlind/ai-alt-text/releases/latest/download/ai-alt-text.zip)
    - Upload via Plugins &gt; Add New &gt; Upload Plugin
    - Activate the plugin.
    - Go to **Settings → AI Alt Text** to configure your AI provider
- **Composer Install**

    ```
    composer require soderlind/ai-alt-text
    ```
- **Updates**

    - Plugin [updates are handled automatically](https://github.com/soderlind/wordpress-plugin-github-updater#readme) via GitHub. No need to manually download and install updates.

Configuration
-------------

[](#configuration)

### Via Admin Settings

[](#via-admin-settings)

Navigate to **Settings → AI Alt Text** and configure:

1. Select your AI provider
2. Enter your API key
3. Optionally customize the model and other settings

### Via Constants (wp-config.php)

[](#via-constants-wp-configphp)

```
// AI Provider: 'openai', 'anthropic', 'gemini', 'azure', 'ollama', 'grok'
define( 'AI_ALT_TEXT_PROVIDER', 'openai' );

// API Key
define( 'AI_ALT_TEXT_API_KEY', 'your-api-key-here' );

// Optional: Custom model
define( 'AI_ALT_TEXT_MODEL', 'gpt-4o' );

// Azure-specific settings
define( 'AI_ALT_TEXT_AZURE_ENDPOINT', 'https://your-resource.openai.azure.com' );
define( 'AI_ALT_TEXT_AZURE_DEPLOYMENT', 'your-deployment-name' );

// Ollama-specific settings
define( 'AI_ALT_TEXT_OLLAMA_HOST', 'http://localhost:11434' );
```

### Via Environment Variables

[](#via-environment-variables)

```
AI_ALT_TEXT_PROVIDER=openai
AI_ALT_TEXT_API_KEY=your-api-key-here
AI_ALT_TEXT_MODEL=gpt-4o
```

Usage
-----

[](#usage)

### Bulk Update

[](#bulk-update)

1. Go to **Media → Library** (list view)
2. Select images you want to update
3. Choose "Generate AI Alt Text" from the bulk actions dropdown
4. Click "Apply"

### From the Block Editor

[](#from-the-block-editor)

1. Add or select an image block
2. In the sidebar, find the "AI Alt Text" panel
3. Click "Generate Alt Text with AI"

AI Providers
------------

[](#ai-providers)

ProviderModelNotesOpenAIgpt-4oRequires API key from [OpenAI](https://platform.openai.com/)Anthropicclaude-sonnet-4-20250514Requires API key from [Anthropic](https://console.anthropic.com/)Google Geminigemini-2.0-flashRequires API key from [Google AI Studio](https://aistudio.google.com/)Azure OpenAIgpt-4oRequires Azure subscription and deploymentOllamallavaFree, runs locally. Install from [ollama.ai](https://ollama.ai/)Grokgrok-2-vision-1212Requires API key from [xAI](https://x.ai/)For detailed configuration instructions, see [AI Provider Documentation](docs/AI-PROVIDERS.md).

Hooks &amp; Filters
-------------------

[](#hooks--filters)

### Modify Generated Alt Text

[](#modify-generated-alt-text)

```
add_filter( 'ai_alt_text_generated', function( $alt_text, $attachment_id ) {
    // Modify the generated alt text
    return $alt_text;
}, 10, 2 );
```

### Customize the AI Prompt

[](#customize-the-ai-prompt)

```
add_filter( 'ai_alt_text_prompt', function( $prompt, $language ) {
    // Customize the prompt sent to the AI
    return $prompt;
}, 10, 2 );
```

### Skip Auto-generation for Specific Images

[](#skip-auto-generation-for-specific-images)

```
add_filter( 'ai_alt_text_should_generate', function( $should_generate, $attachment_id ) {
    // Return false to skip auto-generation
    return $should_generate;
}, 10, 2 );
```

Translations
------------

[](#translations)

The plugin is translation-ready. Translation files are located in the `languages/` directory.

### Creating a Translation

[](#creating-a-translation)

1. Copy `languages/ai-alt-text.pot` to `languages/ai-alt-text-{locale}.po`
    - Example: `ai-alt-text-nb_NO.po` for Norwegian Bokmål
    - Example: `ai-alt-text-de_DE.po` for German
2. Translate the strings using [Poedit](https://poedit.net/) or similar tool
3. Save to generate the `.mo` file
4. For JavaScript translations, run: ```
    wp i18n make-json languages/
    ```

### Available Locales

[](#available-locales)

Contributions welcome! Submit your translation via a pull request.

Development
-----------

[](#development)

### Building Assets

[](#building-assets)

```
npm install
npm run build
```

### Running Tests

[](#running-tests)

```
# JavaScript tests
npm test

# PHP tests
./vendor/bin/phpunit
```

### Code Standards

[](#code-standards)

```
# Check PHP code standards
./vendor/bin/phpcs

# Fix PHP code standards
./vendor/bin/phpcbf
```

License
-------

[](#license)

GPL v2 or later. See [LICENSE](LICENSE) for details.

Credits
-------

[](#credits)

Developed by [Per Soderlind](https://soderlind.no).

Support
-------

[](#support)

- [GitHub Issues](https://github.com/soderlind/ai-alt-text/issues)

###  Health Score

40

—

FairBetter than 88% of packages

Maintenance81

Actively maintained with recent releases

Popularity2

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 94.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

4

Last Release

172d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1649452?v=4)[Per Søderlind](/maintainers/soderlind)[@soderlind](https://github.com/soderlind)

---

Top Contributors

[![soderlind](https://avatars.githubusercontent.com/u/1649452?v=4)](https://github.com/soderlind "soderlind (18 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")

---

Tags

a11yaialt-textwordpress-pluginpluginwordpressaiopenaiimagesmediaaccessibilityseoGeminiclaudeollamagpt-4alt texta11ygrok

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/soderlind-ai-alt-text/health.svg)

```
[![Health](https://phpackages.com/badges/soderlind-ai-alt-text/health.svg)](https://phpackages.com/packages/soderlind-ai-alt-text)
```

###  Alternatives

[cognesy/instructor-php

The complete AI toolkit for PHP: unified LLM API, structured outputs, agents, and coding agent control

310107.9k1](/packages/cognesy-instructor-php)[wp-sync-db/wp-sync-db-media-files

WP Sync DB Media File Addon for WP Sync DB

535151.4k](/packages/wp-sync-db-wp-sync-db-media-files)[humanmade/gaussholder

Fast and lightweight image previews for WordPress

196119.7k](/packages/humanmade-gaussholder)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
