WP AI Content Kit
Example WordPress plugin using the WP AI Client.
by Rich Tabor · github.com/richtabor/wp-ai-content-kit · website
★ 11stars
1forks
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/richtabor/wp-ai-content-kit/archive/refs/heads/main.zipReadme
WP AI Content Kit
AI-powered alt text and excerpt generation for WordPress, built on the WordPress AI Client.
What it does
- Generates image alt text automatically on upload (when alt text is empty)
- Adds a "Generate/Regenerate" button in the Media Library for on-demand alt text
- Generates post excerpts on publish (when excerpt is empty and content is long enough)
- Registers Abilities API abilities for both features (discoverable via REST/MCP)
Requirements
- WordPress 7.0+
- PHP 7.4+
- At least one AI provider plugin (for example Anthropic or OpenAI)
- A configured provider API key
Installation
- Copy this plugin to
wp-content/plugins/wp-ai-content-kit/. - Activate
WP AI Content Kit. - Activate at least one provider plugin, for example:
ai-provider-for-anthropicai-provider-for-openai
- Configure credentials for that provider via environment variable or constant.
Examples:
// wp-config.php (example)
define( 'ANTHROPIC_API_KEY', 'your-key' );
// or
define( 'OPENAI_API_KEY', 'your-key' );
Note: this stack does not provide a built-in Settings > AI Credentials screen. Credentials are read from provider env vars/constants.
How it works
Abilities (manual, callable via Abilities API/REST/MCP):
wp-ai-content-kit/generate-alt-textwp-ai-content-kit/generate-excerpt
Automatic hooks (not ability calls):
add_attachment-> generates alt text for new image uploads when alt text is emptysave_post-> generates excerpt for publishedpostposts when excerpt is empty and stripped content is at least 200 chars
Optional model overrides
// Alt text: force provider + preferred model.
add_filter( 'wpai_content_kit_alt_text_provider', function () {
return 'openai';
} );
add_filter( 'wpai_content_kit_alt_text_model_preferences', function () {
return array( 'gpt-5-mini' );
} );
// Excerpt: force provider + preferred model.
add_filter( 'wpai_content_kit_excerpt_provider', function () {
return 'anthropic';
} );
add_filter( 'wpai_content_kit_excerpt_model_preferences', function () {
return array( 'claude-sonnet-4' );
} );
Model preferences are best-effort; if unavailable, AI Client falls back to a compatible model.