WP Manifestindependent plugin directory
manifest / ai / ai-metadata-optimizer

AI Content Metadata Updater

Bulk update WordPress content metadata (posts, pages, media) using Google Gemini AI. Generates SEO-optimized titles, descriptions, excerpts, and more.

by ahamill85 · github.com/ahamill85/ai-metadata-optimizer · 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/ahamill85/ai-metadata-optimizer/archive/refs/heads/main.zip

Bulk update WordPress content metadata (posts, pages, media) using Google Gemini AI. Generates SEO-optimized titles, descriptions, excerpts, and more.

Features

  • Dual Processing Pages: Separate interfaces for processing images and pages/posts
  • Batch Processing: Process items in configurable batch sizes for safe, incremental updates
  • Review Mode: Manually approve changes before saving (optional auto-accept)
  • AI Analysis: Uses Google Gemini API to analyze and generate metadata
  • SEO Fields: Generates SEO page titles, meta descriptions, and Schema.org markup
  • Frontend Output: Automatically renders generated SEO fields in page <title>, <meta> tags, and JSON-LD
  • Editable Metabox: Edit AI-generated fields directly on post/page edit screens
  • Post Type Selection: Configure which post types to process
  • Progress Tracking: Real-time progress bars and status counts
  • Debug Logging: Comprehensive error and API response logging for troubleshooting

Installation

  1. Upload the ai-media-metadata-updater folder to /wp-content/plugins/
  2. Activate the plugin through the WordPress Plugins menu
  3. Go to AI Content Updater in the WordPress admin menu
  4. Configure your Google Gemini API key in Settings

Configuration

Settings Page

  • Google Gemini API Key: Required. Get one free at Google AI Studio
  • Batch Size: Default number of items processed per run (1-50, default: 5)
  • Post Types to Process: Select which post types (Posts, Pages, Custom) to include in batch processing

Processing Pages

Process Images

  • Override batch size for this run
  • Enable "Manually approve changes" for review mode
  • View image library status and progress

Process Pages & Posts

  • Override batch size for this run
  • Enable "Manually approve changes" for review mode
  • View pages/posts library status and progress

How It Works

Automatic Processing

  1. Click "Process Next N Items" button
  2. Plugin fetches unprocessed items
  3. Sends each to Google Gemini API for analysis
  4. If review mode is OFF: saves metadata and marks as processed
  5. If review mode is ON: displays results for manual approval

Review Mode

  1. Results appear in a table with editable fields
  2. Click Accept to save changes, or Discard to skip
  3. Updates metadata and marks item as processed

Metadata Fields

Images

Generates and saves:

  • Title: Image filename or descriptive title
  • Alt Text (_wp_attachment_image_alt): Accessibility text
  • Caption: Image caption
  • Description: Detailed description

Pages/Posts

Generates and saves:

Field Meta Key Frontend Use
Post Title post_title Page heading
Excerpt post_excerpt Manual excerpt field
SEO Title _ai_cmu_seo_title Browser <title> tag
Meta Description _ai_cmu_meta_description <meta name="description">
SEO Description _ai_cmu_seo_description Fallback SEO description
Schema Type _ai_cmu_schema_type JSON-LD @type (Article, BlogPosting, NewsArticle, WebPage)

Processing Flag: _ai_cmu_processed (value: 1) marks items as processed and excludes them from future batches.

Frontend Output

The plugin automatically renders generated SEO metadata on singular post/page views:

  • Page Title: Overrides <title> tag with _ai_cmu_seo_title if available
  • Meta Description: Outputs <meta name="description"> from _ai_cmu_meta_description
  • JSON-LD Schema: Generates structured data using Schema.org format with:
    • Headline (from SEO title)
    • Description
    • Author
    • Publisher
    • Date Published
    • Schema Type (Article, BlogPosting, etc.)

Editing SEO Fields

Each post/page edit screen includes an "AI Content Metadata – SEO Fields" metabox where you can:

  • Edit SEO Page Title
  • Edit Meta Description
  • Edit Alternative SEO Description
  • Select Schema.org Type
  • View processing status

Changes save automatically with the post.

Debug Logging

The plugin logs detailed information to wp-content/debug.log (requires WP_DEBUG and WP_DEBUG_LOG enabled in wp-config.php):

// Enable debug logging in wp-config.php
define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
define('WP_DEBUG_DISPLAY', false);

Common Logs:

  • [AI CMU] analyze_content called for post... – Item processing started
  • [AI CMU] Gemini raw response:... – API response received
  • [AI CMU] Analysis result for post... – Parsed metadata
  • [AI CMU] Updating post... – Saving to database
  • [AI CMU ERROR] – Any errors encountered

View logs:

tail -n 200 wp-content/debug.log
grep "AI CMU" wp-content/debug.log | tail -n 100

Troubleshooting

"Missing API key - set it on the plugin Settings page"

Ensure you've entered a valid Google Gemini API key on the Settings page.

"Missing item_id" or POST parameter issues

Check the browser console and wp-content/debug.log for AJAX error details.

Items not being processed

  • Verify items don't already have _ai_cmu_processed meta flag set
  • Check that the API key is valid and has quota remaining
  • Check wp-content/debug.log for Gemini API errors

SEO fields not displaying on frontend

  • Confirm metadata was saved (check the post metabox or wp-content/wp-postmeta table)
  • Verify your theme doesn't override the <title> or <meta> tags
  • Check that inc/frontend-seo.php is included/active

Resetting Items for Reprocessing

Visit the plugin Settings page and click "Reset Processing Status" to remove _ai_cmu_processed flags from all items, allowing them to be reprocessed.

Requirements

License

GPL-2.0-or-later. See LICENSE for details.

Resetting AI Status for Individual Items

The plugin provides a "Reset AI Status" link in the admin row actions for posts, pages, and media items that have been processed by AI (i.e., have the _ai_cmu_processed meta key set). This allows you to reset the status for a single item so it can be reprocessed by the AI batch tools.

How to Use:

  • In the WordPress admin, go to Posts, Pages, or Media Library.
  • For items that have been processed, click the Reset AI Status link in the row actions.
  • The item will be reset and can be processed again in the next batch.

Security:

  • Nonce verification is used to protect reset actions.
  • Only users with permission to edit the item can reset its status.

Customization:

  • The reset link appears for all public post types and media attachments.
  • Logic is handled in inc/reset-status.php.

Support & Contributing

For issues, feature requests, or contributions, please submit them through the plugin repository or contact the maintainer.


Version: 2.0.0
Last Updated: February 2026