Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

MarJC5/wp-agent

Repository files navigation

WP Agent

AI-powered chat assistant for WordPress administration.

Overview

WP Agent adds an interactive AI chat to the WordPress admin at Tools > AI Chat. It helps administrators manage content, debug issues, inspect code, and diagnose problems through a conversational interface with 30+ agent tools.

The plugin has a modular extension system that auto-detects installed plugins (Yoast SEO, ACF, TranslatePress, Solid Security) and loads additional tools and AI instructions only when they are active.

Requirements

  • PHP 7.4+
  • WordPress 6.9+
  • Infomaniak AI Toolkit plugin (required dependency, enforced via Requires Plugins header)
  • At least one AI provider configured (Infomaniak, Anthropic, or OpenAI)

Installation

  1. Install and activate the Infomaniak AI Toolkit plugin
  2. Configure an AI provider via Settings > Connectors
  3. Upload this plugin to wp-content/plugins/wp-agent/
  4. Activate via Plugins
  5. Open Tools > AI Chat

Core Tools

Always available with any WordPress installation.

Domain Tools Examples
Content 9 Search, create, update, delete posts; manage metadata
Media 3 List media, get post images, update attachments
Plugins 2 Search wordpress.org, install plugins
Diagnostics 7 Plugins, themes, cron, options, users, environment, site info
Debug 4 Debug log, debug status, PHP info, error analysis
Filesystem 3 Read files, list directories, search code (read-only)
Web 2 Web search, fetch URL content

Extensions

Extensions auto-detect installed plugins and add specialized tools. No configuration needed -- activate the plugin and the tools appear in the chat.

Extension Plugin Tools Capabilities
Yoast SEO wordpress-seo 3 SEO analysis, bulk audit, update all Yoast fields (keyphrase, OG, Twitter, robots, schema, cornerstone)
ACF Pro advanced-custom-fields-pro 4 Read/write custom fields, inspect field groups, manage repeater rows
TranslatePress translatepress-multilingual 4 List languages, check translation status, translate content and static strings via AI
Solid Security better-wp-security 3 Security status overview, security logs, active lockouts monitoring

Adding a custom extension

Create a class implementing ExtensionInterface in src/Extensions/YourPlugin/:

namespace WpAgent\Extensions\YourPlugin;
use WpAgent\Extensions\ExtensionInterface;
class YourPluginExtension implements ExtensionInterface
{
 public function id(): string { return 'your-plugin'; }
 public function name(): string { return 'Your Plugin'; }
 public function isActive(): bool { return function_exists('your_plugin_function'); }
 public function tools(): array { return [ /* Tool instances */ ]; }
 public function systemPrompt(): string { return '### Your Plugin\nInstructions...'; }
}

Register it in ExtensionLoader::$extensions or via ExtensionLoader::register().

Slash Commands

Type / in the chat to see available commands. Commands are auto-discovered from ai-commands/ directories.

Content: /create-post, /draft-post, /bulk-drafts, /update-post, /delete-post, /create-page, /summarize, /blog-outline, /write-excerpt

SEO: /seo-meta, /seo-images, /seo-audit, /seo-fix

Translation: /translate, /translate-all

Other: /install-plugin, /explain-error

Security

  • Read-only filesystem -- no file editing or deletion
  • Two-step confirmation -- all write operations require preview + explicit approval
  • Path validation -- realpath + ABSPATH boundary check, traversal blocked
  • Sensitive files blocked -- .env, .htpasswd, certificates, database dumps
  • Credentials masked -- DB_PASSWORD, auth keys in wp-config.php replaced with ***
  • Admin only -- requires manage_options capability
  • Web search confirmation -- user must approve before searching

Streaming

Responses stream in real-time (token by token) when using Infomaniak models. Other providers (Anthropic, OpenAI) use synchronous responses.

Architecture

src/
├── Tools/ # Core WordPress tools (always loaded)
│ ├── Content/ # Posts, pages, metadata
│ ├── Media/ # Attachments, images
│ ├── Debug/ # Debug log, PHP info
│ ├── Diagnostics/ # Plugins, themes, cron, options
│ ├── Filesystem/ # Read files, search code
│ ├── Plugins/ # Search & install from wp.org
│ └── Concerns/ # Shared traits
├── Extensions/ # Plugin integrations (loaded conditionally)
│ ├── Yoast/
│ ├── Acf/
│ ├── TranslatePress/
│ └── SolidSecurity/
├── Presets/ # ChatPreset (agent configuration)
├── Chat/ # Slash handler, conversation repo, debug
└── Admin/ # Chat page, views, Vite assets

Development

npm install
npm run dev # Vite dev server
npm run build # Production build

Frontend: Alpine.js + marked + highlight.js + DOMPurify + pretext.

License

GPL-2.0-or-later

About

AI-powered chat assistant for WordPress administration

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

Contributors

AltStyle によって変換されたページ (->オリジナル) /