Skip to content

richtabor/wp-ai-content-kit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

  1. Copy this plugin to wp-content/plugins/wp-ai-content-kit/.
  2. Activate WP AI Content Kit.
  3. Activate at least one provider plugin, for example:
    • ai-provider-for-anthropic
    • ai-provider-for-openai
  4. 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-text
  • wp-ai-content-kit/generate-excerpt

Automatic hooks (not ability calls):

  • add_attachment -> generates alt text for new image uploads when alt text is empty
  • save_post -> generates excerpt for published post posts 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.

About

Example WordPress plugin using the WP AI Client.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages