WP Manifestindependent plugin directory
manifest / ai / wp-agent-ai

WP Agent AI

WP Agent AI — Intelligent content assistant for the WordPress Gutenberg block editor

by Mohsin Dev · github.com/devmohsin/wp-agent-ai · website

0stars
0forks

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/devmohsin/wp-agent-ai/archive/refs/heads/main.zip

An intelligent content assistant for the WordPress Gutenberg block editor. Generate structured, publication-ready content using AI — directly inside the editor.


What It Does

WP Agent AI adds an AI Content Generator block to the Gutenberg block inserter. A user describes what they want in plain English, selects a content type and tone, clicks Generate, and the AI returns fully editable WordPress core blocks — headings, paragraphs, buttons, lists, and quotes — inserted directly into the editor at the exact position of the generator block.

Supported content types:

  • Hero Section
  • Feature List
  • FAQ
  • Testimonials
  • Call to Action
  • Paragraph

Requirements

Requirement Minimum Version
WordPress 6.3
PHP 8.0
OpenRouter API Key Required (see Configuration)

Installation

  1. Upload the wp-agent-ai folder to /wp-content/plugins/
  2. Activate the plugin through Plugins → Installed Plugins in the WordPress admin
  3. Navigate to WP Agent AI → Settings to configure your API key
  4. Insert the AI Content Generator block anywhere in the Gutenberg editor

Building Assets (Development)

npm install
npm run build

For active development with file watching:

npm run start

Configuration

API Key

  1. Sign up at openrouter.ai and generate an API key
  2. Go to WordPress Admin → WP Agent AI → Settings
  3. Paste your API key into the OpenRouter API Key field
  4. Click Test Connection to verify the key is valid
  5. Save settings

The API key is encrypted before being stored in the database. It is never exposed in the browser, in JavaScript files, or in REST API responses.

Model Selection

Select the AI model to use for content generation from the Model dropdown. Available options: GPT-4o, GPT-4o-mini, Claude Sonnet, Gemini Flash, DeepSeek Chat v3.

Cost guidance:

  • Use GPT-4o or Claude Sonnet for hero sections and calls to action
  • Use GPT-4o-mini or DeepSeek for feature lists, FAQs, and paragraphs

Usage

  1. Open any post or page in the Gutenberg editor
  2. Click the + block inserter and search for AI Content Generator
  3. Insert the block at the position where you want the content to appear
  4. Type a description of what you want to generate
  5. Select Content Type, Tone, and Length
  6. Click Generate
  7. The AI-generated content is inserted immediately as fully editable native WordPress blocks (headings, paragraphs, buttons, etc.) at the block's position — the generator block removes itself
  8. Click Regenerate to try again with the same prompt, or use the Refine input to give specific improvement instructions before regenerating
  9. Click Start Over to reset the prompt and start fresh

Security

  • API key is AES-256 encrypted at rest — never stored in plain text
  • All REST endpoints require a valid WordPress nonce
  • All REST endpoints require the edit_posts capability — guests and subscribers are blocked
  • All user inputs are sanitised server-side before the API call
  • All AI-generated content is passed through wp_kses_post() before being returned
  • Rate limiting enforced per user (10 requests/60 seconds) and globally (daily spend cap)

Known Limitations

  • Requires an active internet connection to reach the OpenRouter API
  • Generation speed depends on the selected model and OpenRouter server load (typically 3–10 seconds)
  • The plugin does not support streaming responses in the current version
  • Content history / undo beyond the editor's native undo stack is not implemented in v1.0.0
  • On shared hosting with a 30-second PHP execution limit, set_time_limit(120) is called per request — this works on most hosts but may not be permitted on all configurations

Changelog

1.0.0

  • Initial release
  • AI Content Generator block
  • OpenRouter API integration with model selection
  • Admin settings page with encrypted API key storage and test connection
  • Full error handling for all failure scenarios
  • Rate limiting and daily spend cap

License

GPL-2.0-or-later — see GNU GPL v2