=== WikiPress AI Writer ===
Contributors: wikipress
Tags: ai, openai, article generator, content, wiki, encyclopedia
Requires at least: 5.8
Tested up to: 6.5
Requires PHP: 7.4
Stable tag: 5.2.2
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Generate Wikipedia-style encyclopedia articles using OpenAI API. Create structured wiki articles with infoboxes, FAQs, and more from a simple topic input.

== Description ==

WikiPress AI Writer connects your WordPress site to the OpenAI API to generate comprehensive, structured wiki-style articles. Enter a topic, configure your preferences, and the plugin produces a complete encyclopedia entry with infoboxes, FAQs, related terms, and references — all formatted as a WordPress post.

**Key Features:**

* AI-powered article generation using OpenAI models (GPT-4.1, GPT-4o, GPT-4 Turbo, GPT-3.5 Turbo)
* Structured output: Short Answer, Overview, History, Importance, FAQ, References, and more
* Editable prompt template with placeholders for language, tone, and length
* Instant preview with tabbed interface (Preview, HTML, SEO, Quick Facts, FAQ, JSON)
* Save as draft or publish directly
* Auto-assign categories, tags, and post meta
* Comprehensive generation logs
* Compatible with the WikiPress theme (fills infobox meta fields automatically)
* API key never exposed in frontend — all requests are server-side
* AI Silo Builder turns topics or keywords into reviewable parent and subcategory structures
* Planetary Boundaries Dashboard shortcode with interactive scientific data, normalized pressure math, and deep links
* Planetary Boundary Explorer shortcode with thresholds, historical milestones, boundary interactions, and solution pathways
* Country Environmental Profile shortcode with eight source-attributed indicators for more than 200 countries and territories
* Food Impact Comparison Tool with per-product, protein, and calorie comparison bases
* Environmental Unit Converter with tested physical and nutrient-species factors
* Secure: nonce verification, capability checks, input sanitization, output escaping

== Installation ==

1. Upload the `wikipress-ai-writer` folder to `/wp-content/plugins/` directory.
2. Activate the plugin through the 'Plugins' menu in WordPress.
3. Go to **WikiPress AI → Settings** and enter your OpenAI API key.
4. Go to **WikiPress AI → Generate Article** to create your first article.

== AI Content Audit Agent ==

WikiPress AI Writer includes a powerful autonomous **AI Content Audit Agent** that works in the background to analyze, organize, and improve your encyclopedia articles.

**Agent Capabilities:**
* **Content Auditing:** Scans your published articles to evaluate completeness, trustworthiness, and overall quality.
* **Auto-Fix Missing Elements:** Automatically generates and fills in missing encyclopedia components like Short Answers, Infoboxes, FAQs, References, and Related Terms without human intervention (configurable).
* **Silo Structure & Taxonomy:** Analyzes your site's topical silos. It intelligently suggests or auto-assigns correct parent categories, subcategories, and tags based on search intent and topical authority.
* **Review Queue:** For complex changes, the Agent places its recommendations into a "Review Queue" with a confidence score. Human editors can review, approve, or ignore these suggestions with a single click.
* **Background Processing:** Configure the Agent to run on a set schedule (e.g., weekly) to continuously audit batches of articles, keeping your wiki pristine and fully linked.

You can manage the agent by navigating to **WikiPress AI → Agent Dashboard**.

== Frequently Asked Questions ==

= Do I need an OpenAI API key? =

Yes. You can get one from https://platform.openai.com/api-keys.

= Which OpenAI models are supported? =

GPT-4.1, GPT-4.1 Mini, GPT-4.1 Nano, GPT-4o, GPT-4o Mini, GPT-4 Turbo, GPT-3.5 Turbo, and custom model names.

= Is my API key safe? =

Yes. The key is stored in the WordPress database, never exposed in frontend JavaScript, and masked in the admin UI. All API calls are server-side.

= Can I customize the prompt? =

Yes. Go to **WikiPress AI → Prompt Template** to edit the full prompt sent to OpenAI.

= Does this work with the WikiPress theme? =

Yes! When the WikiPress theme is active, the plugin automatically fills its infobox and article meta fields.

== Changelog ==

= 5.2.2 =
* Added post-type-aware taxonomy selectors to Generate Article and Bulk Generator.
* Added taxonomy-aware AI prompting, queue validation, and term assignment for public CPTs.

= 5.2.1 =
* Added per-generation post type selection for posts, pages, and public custom post types.
* Added post type storage and display to the bulk generation queue.

= 5.2.0 =
* Added the `[environmental_unit_converter]` shortcode and `[wpaw_environmental_unit_converter]` alias.
* Added reversible conversions for CO2e, energy, land, water, ppm ratios, nitrogen, nitrate, phosphorus, and phosphate units.

= 5.1.0 =
* Added the `[food_impact_comparison]` shortcode and `[wpaw_food_impact_comparison]` alias.
* Added source-attributed comparisons for GHG emissions, land use, freshwater use, and eutrophication across three nutritional bases.

= 5.0.0 =
* Added the `[country_environmental_profile]` shortcode and `[wpaw_country_environmental_profile]` alias.
* Added country profiles for emissions, energy, forests, freshwater, air pollution, material footprint, protected land, and climate vulnerability.

= 4.9.0 =
* Added the `[planetary_boundary_explorer]` shortcode and `[wpaw_planetary_boundary_explorer]` alias.
* Added interactive boundary history, interactions, and solution pathways linked to verified dashboard control variables.

= 4.8.0 =
* Added the `[planetary_boundaries_dashboard]` shortcode and `[wpaw_planetary_boundaries]` alias.
* Added a responsive, theme-matched radial dashboard with keyboard-accessible boundary navigation and copyable deep links.
* Added tested normalization for higher-is-worse, lower-is-worse, and boundaries without a quantified high-risk line.

= 4.7.0 =
* Added an AI Silo Builder with topic/keyword input and configurable maximum silo and subcategory counts.
* Added a review-first workflow that creates approved structures as WordPress categories and safely reuses existing categories.

= 4.4.3 =
* Added recurring watchdogs that recover interrupted continuous generation and regeneration queues.
* Fixed failure limits so they count consecutive failures instead of all historical failed items.
* Added automatic backoff and recovery after Ollama timeouts and worker exceptions.
* Fixed bulk failure logs to record the active provider model.

= 1.0.0 =
* Initial release.
