=== AI Bulk SEO Meta ===
Contributors: maisyai
Tags: seo, metadata, artificial intelligence, bulk editing, content optimization
Requires at least: 6.2
Tested up to: 7.0
Requires PHP: 7.4
Stable tag: 1.0.1
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Generate missing SEO titles, meta descriptions, and focus keyphrases in controlled background batches using OpenAI.

== Description ==

AI Bulk SEO Meta finds published posts and pages with incomplete metadata for Yoast SEO and uses the OpenAI Responses API to regenerate three fields as one consistent set:

* SEO title
* Meta description
* Focus keyphrase

The plugin skips an item only when all three fields already exist. If any field is missing, it regenerates and replaces all three so the title, description, and keyphrase stay aligned.

The dashboard shows separate incomplete counts for posts and pages. Load and run the next 10, 20, or 50 items, or select specific content from Posts > All Posts or Pages > All Pages and choose Add AI SEO Meta. The persistent queue continues after the browser closes.

A compact metadata index powers the counts, filters, and sortable SEO Meta column without repeatedly scanning the full WordPress post-meta table. The index builds in small background chunks and stays synchronized as metadata changes.

Queue protections include automatic retries, stale-job recovery, a worker watchdog that runs only while work is active, status filtering, pagination, exact result messages, and a clear warning when no OpenAI API key is installed.

Administrators can stop processing and clear all active queue records without removing metadata already generated or deleting completed history.

== Installation ==

1. Install and activate Yoast SEO.
2. Upload and activate AI Bulk SEO Meta.
3. Open Tools > AI Bulk SEO Meta.
4. Add an OpenAI API key and save settings.
5. Choose Posts or Pages, then load and run the next 10, 20, or 50 incomplete items.
6. Monitor progress on the plugin dashboard. Processing starts automatically.

For specific items, select them under Posts > All Posts or Pages > All Pages and apply Add AI SEO Meta.

You may define `ABSEM_OPENAI_API_KEY` in wp-config.php instead of storing a key in WordPress:

`define( 'ABSEM_OPENAI_API_KEY', 'your-key-here' );`

== External services ==

This plugin connects to the OpenAI API only after an administrator configures an API key and starts a batch. It sends the post or page title, permalink, and up to 18,000 characters of plain-text content to generate metadata. The service is provided by OpenAI and may require paid API credits.

OpenAI terms: https://openai.com/policies/terms-of-use/

OpenAI privacy policy: https://openai.com/policies/privacy-policy/

Nothing is sent to OpenAI merely by installing or activating the plugin.

== Screenshots ==

1. Main dashboard with indexed missing-metadata counts, batch controls, queue status, and history.
2. Posts screen with fast metadata filtering, sortable status, and the Add AI SEO Meta bulk action.
3. WordPress dashboard widget with missing counts, queue health, and quick actions.

== Frequently Asked Questions ==

= Does it overwrite existing metadata? =

If all three supported fields exist, the item is skipped. If any field is missing, the plugin regenerates and replaces all three as a consistent set.

= Is Yoast SEO Premium required? =

No. The free version is supported.

= Does processing continue after I close the browser? =

Yes. The database-backed queue runs through WP-Cron. Sites with WP-Cron disabled should configure a real server cron to call wp-cron.php.

= What happens if a request fails? =

The plugin retries the request up to three times. Permanent failures remain visible on the dashboard and can be retried manually. Stale processing jobs are recovered automatically.

= Can I stop a running queue? =

Yes. Use Stop and clear active queue on the plugin dashboard. It removes queued and processing jobs while preserving generated metadata and completed history. If an OpenAI request is already in flight, its response is discarded before metadata is written.

= Does a ChatGPT subscription include API usage? =

No. OpenAI API billing is separate from ChatGPT subscriptions.

== Changelog ==

= 1.0.1 =
* Adds a Stop and clear active queue control.
* Prevents a canceled in-flight request from writing metadata after the active queue is cleared.

= 1.0.0 =
* First public release under the AI Bulk SEO Meta name.
* Adds background generation for SEO titles, meta descriptions, and focus keyphrases on posts and pages.
* Adds a fast metadata status index, dashboard batch loading, list-table filters, sortable status, queue recovery, and dashboard widget.
