定制 travelopia/wordpress-ai 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

travelopia/wordpress-ai

最新稳定版本:0.1.1

Composer 安装命令:

composer require travelopia/wordpress-ai

包简介

README 文档

README

maintenance-status

An extensible WordPress plugin that brings AI capabilities to your content workflows. Configure your preferred AI provider once, and unlock a growing set of features — starting with automatic image alt text generation.

Built by the super talented team at Travelopia.

Installation

composer require travelopia/wordpress-ai

AI Providers

The plugin supports multiple providers out of the box:

  • AWS Bedrock (default)
  • OpenAI

Provider Configuration

AWS Bedrock (Claude 3.5 Sonnet) — set via wp-config.php or environment variable:

define( 'AWS_BEDROCK_API_KEY', 'your-key-here' );
define( 'AWS_BEDROCK_REGION', 'us-east-1' ); // optional, defaults to us-east-1
export AWS_BEDROCK_API_KEY="your-key-here"
export AWS_BEDROCK_REGION="us-east-1" # optional, defaults to us-east-1

OpenAI (GPT-4o Mini) — set via wp-config.php or environment variable:

define( 'OPENAI_API_KEY', 'your-key-here' );
export OPENAI_API_KEY="your-key-here"

Features

Alt Text Generation

Automatically generates descriptive alt text for images — improving accessibility and SEO with zero manual effort.

  • Auto-generate on upload — alt text is filled in the moment an image hits the Media Library
  • Generate for existing images — click "Generate Alt Text" from the attachment edit screen
  • Batch processing via WP-CLI — backfill alt text for your entire media library
  • Respects manual alt text — never overwrites unless you explicitly regenerate
  • Customizable prompt — tailor the generation instructions from the settings page

WP-CLI examples:

wp travelopia-wp-ai alt-text generate --missing   # only images without alt text
wp travelopia-wp-ai alt-text generate --all        # every image
wp travelopia-wp-ai alt-text generate --ids=1,2,3  # specific attachments

Hooks

Filters

travelopia_wordpress_ai_provider — Switch the active AI provider.

add_filter(
	'travelopia_wordpress_ai_provider',
	fn() => 'openai'
);

travelopia_wordpress_ai_alt_text_generation_options — Override model, temperature, or system instruction for alt text generation.

add_filter(
	'travelopia_wordpress_ai_alt_text_generation_options',
	function ( array $options, int $attachment_id ): array {
		$options['model']              = 'anthropic.claude-3-5-sonnet-20241022-v2:0';
		$options['temperature']        = 0.5;
		$options['system_instruction'] = 'You are an accessibility expert.';
		return $options;
	},
	10,
	2
);

travelopia_wordpress_ai_alt_text_include_context — By default, the plugin sends the image title and filename as additional context alongside the image to help the AI produce more accurate alt text. Set this to false to send only the image itself.

add_filter(
	'travelopia_wordpress_ai_alt_text_include_context',
	'__return_false'
);

travelopia_wordpress_ai_settings_capability — Control which user role can access the plugin settings page. Defaults to manage_options (Administrator).

add_filter(
	'travelopia_wordpress_ai_settings_capability',
	fn() => 'edit_posts'
);

Actions

travelopia_wordpress_ai_alt_text_generated — Fired after alt text is successfully generated for an attachment.

add_action(
	'travelopia_wordpress_ai_alt_text_generated',
	function ( int $attachment_id, string $alt_text ): void {
		// Log, notify, or post-process.
	},
	10,
	2
);

travelopia_wordpress_ai_bedrock_error / travelopia_wordpress_ai_open_ai_error — Fired when a provider encounters an error during generation.

add_action(
	'travelopia_wordpress_ai_bedrock_error',
	function ( string $code, string $message, array $data ): void {
		// Handle error.
	},
	10,
	3
);

Local Development

Requires Docker to be installed and running.

npm run start            # install deps and start the dev environment
npm run wp-env:start     # start the dev environment (without installing deps)
npm run wp-env:stop      # stop the dev environment
npm run test:php:setup   # install deps in container and run PHP tests (first run)
npm run test:php         # run PHP tests

Privacy

Images are sent to your configured AI provider for analysis when generating alt text.

统计信息

  • 总下载量: 10
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 3
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2026-03-24

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固