Skip to content

sharanvijaydev/ai-content-toolkit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AI Content Toolkit

A WordPress Gutenberg sidebar plugin that integrates with the OpenAI API to assist content creators directly inside the Block Editor.

WordPress PHP License

Features

Feature Description
📝 Meta Description Generator Generates SEO-optimized meta descriptions (150-160 chars) from post content
🏷️ Tag Suggester Analyzes content and suggests 5-8 relevant, searchable tags
📄 Post Summarizer Creates concise 2-3 sentence summaries, with one-click "Set as Excerpt"

Screenshots

Coming soon

Technical Highlights

  • OOP PHP architecture — Singleton main class, separated concerns (Settings, API Client, AJAX Handler)
  • Security-first — Nonce verification, capability checks, input sanitization, output escaping
  • Gutenberg native — Built with @wordpress/plugins, @wordpress/components, @wordpress/data
  • Clean API abstraction — OpenAI client class with structured prompts and proper error handling via WP_Error
  • WordPress Settings API — Full admin settings page with sanitization and whitelisted model selection

File Structure

ai-content-toolkit/
├── ai-content-toolkit.php          # Main plugin file (singleton bootstrap)
├── includes/
│   ├── class-settings.php          # Admin settings page (API key, model, tokens)
│   ├── class-openai-client.php     # OpenAI API wrapper (wp_remote_post)
│   └── class-ajax-handler.php      # AJAX endpoints with security checks
├── src/
│   ├── index.js                    # Gutenberg sidebar (React components)
│   └── style.css                   # Sidebar styles
├── build/                          # Compiled assets (@wordpress/scripts)
├── package.json
├── .gitignore
└── README.md

Installation

From GitHub

# Clone into your WordPress plugins directory
cd wp-content/plugins/
git clone https://github.com/sharanvijay/ai-content-toolkit.git
cd ai-content-toolkit

# Install dependencies and build
npm install
npm run build

Configuration

  1. Activate the plugin in Plugins → Installed Plugins
  2. Go to Settings → AI Content Toolkit
  3. Enter your OpenAI API key (Get one here)
  4. Select your preferred model and token limit
  5. Open any post in the Block Editor — click the AI Content Toolkit icon in the top-right toolbar

Usage

  1. Write your post content in the Block Editor
  2. Click the AI Content Toolkit sidebar icon (layered diamond icon)
  3. Use any of the three panels:
    • Meta Description → Generate → Edit if needed → Copy
    • Tag Suggestions → Suggest → Copy All
    • Post Summary → Summarize → Set as Excerpt or Copy

Requirements

  • WordPress 6.0+
  • PHP 7.4+
  • OpenAI API key with available credits

Security

  • API key stored in wp_options, never exposed to the frontend
  • All AJAX requests verified with wp_verify_nonce()
  • User capability checked with current_user_can( 'edit_posts' )
  • All input sanitized with sanitize_text_field() / sanitize_textarea_field()
  • Content trimmed to 1000 words to prevent excessive API usage

Development

# Start development mode (auto-rebuild on file changes)
npm run start

# Production build
npm run build

Author

R Saravanan

License

GPL-2.0+ — See LICENSE

About

WordPress Gutenberg sidebar plugin integrating OpenAI API for meta descriptions, tag suggestions, and post summaries.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors