=== AI FAQ Creator – FAQ Schema & Structured Data for WordPress ===
Contributors: devhasib,webtendhq
Tags: faq, faq schema, ai faq generator, structured data, seo faq
Requires at least: 6.0
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.0.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Generate SEO-optimized FAQs using AI (OpenAI, Gemini, Claude). Injects FAQ Schema for Google rich results. Live search, import/export included.

== Description ==

**WebTend AI FAQ Creator** automatically creates professionally written FAQ sections from your page content using artificial intelligence — then injects FAQ Schema (JSON-LD) so Google can show rich results in search.

No copywriting needed. No technical setup. Just open any page, click "Generate FAQs", and you're done.

= ✅ How It Works =

1. Open any WordPress page or post
2. Find the **AI FAQ Generator** meta box
3. Click **Generate FAQs from Page Content**
4. Review and edit the AI-generated FAQs
5. Save the page — FAQ Schema is automatically injected
6. Embed FAQs anywhere with `[wtaf_faq]`

= 🔎 Live FAQ Search =

Every FAQ section includes a built-in live search box. Visitors type a keyword and matching FAQs are instantly shown — no page reload, no plugin dependencies. Matching text is highlighted automatically. Fully accessible with ARIA live regions and keyboard support.

Control search with shortcode attributes:

* `[wtaf_faq]` — search enabled by default
* `[wtaf_faq search="no"]` — disable search
* `[wtaf_faq search_placeholder="Type your question…"]` — custom placeholder

= 🤖 Three AI Providers Supported =

Connect your own API key (BYOK) from any of the three leading AI providers:

* **OpenAI** — GPT-4o Mini, GPT-4o, GPT-4 Turbo
* **Google Gemini** — Gemini 1.5 Flash, Gemini 1.5 Pro
* **Anthropic Claude** — Claude Haiku, Claude Sonnet

= 🔍 SEO Benefits =

* Automatic **FAQPage JSON-LD** schema markup
* Eligible for **Google rich results** (FAQ rich snippets)
* Microdata also added for full compatibility
* Zero manual schema editing required

= ⚡ Features =

* All 3 AI providers (OpenAI, Gemini, Claude)
* **Live FAQ search** with keyword highlighting
* FAQ Schema markup (JSON-LD + Microdata)
* Shortcode: `[wtaf_faq]` with full attribute control
* Gutenberg block support
* 4 tone options: Professional, Friendly, Technical, Simple
* Accordion & List display styles
* Edit and customize generated FAQs
* FAQ Sets management dashboard
* Custom prompt instructions
* Auto-append FAQs to page content (no shortcode needed)
* **Export all FAQ sets as JSON or CSV** — one-click backup
* **Import FAQ sets from JSON or CSV** — migrate from another site or bulk-add hand-crafted FAQs
* Duplicate detection on import (Replace / Skip)
* Translation ready

= 💡 Perfect For =

* Business & service websites
* Landing pages
* Blog posts
* Agency client sites
* Membership sites
* Any page that would benefit from FAQ-based SEO

= 🔒 Privacy & API Keys =

Your API keys are stored securely in your WordPress database and are never shared with WebTend. All AI requests are made directly from your server to the chosen AI provider.

= 🛠 Developer-Friendly =

* Filter: `wtaf_meta_box_screens` — add custom post types to the meta box (see `includes/admin/class-wtaf-meta-box.php`)
* Filter: `wtaf_schema_enabled` — conditionally disable schema injection per post; implemented in `includes/frontend/class-wtaf-schema.php → inject_schema()`
* Auto-append: enable in **AI FAQ Creator → Settings → Display** — implemented via `the_content` filter in `includes/frontend/class-wtaf-shortcode.php → auto_append()`
* Template overrides: copy `templates/faq-accordion.php` or `templates/faq-list.php` into your active theme's root folder — the shortcode checks for theme copies first via `locate_template()`
* Shortcode attributes: `post_id`, `style`, `title`, `class`, `search`, `search_placeholder`

== External Services ==

This plugin connects to third-party AI provider APIs to generate FAQ content. These calls are made **only** when you click "Generate FAQs" in the post editor — no data is sent automatically or on page load.

**What data is sent:** The text content of your WordPress page or post (the content you have written) is sent to the selected AI provider along with configuration parameters (FAQ count, tone). Your site URL or personal data is not included.

**When it is sent:** Only on demand, when you manually trigger FAQ generation from the post editor meta box.

= OpenAI =

Used to generate FAQ content via the GPT model you select (e.g. GPT-4o Mini).

* API endpoint: `https://api.openai.com/v1/chat/completions`
* [OpenAI Terms of Service](https://openai.com/policies/terms-of-use)
* [OpenAI Privacy Policy](https://openai.com/policies/privacy-policy)

= Google Gemini =

Used to generate FAQ content via the Gemini model you select (e.g. Gemini 1.5 Flash).

* API endpoint: `https://generativelanguage.googleapis.com/`
* [Google Terms of Service](https://policies.google.com/terms)
* [Google Privacy Policy](https://policies.google.com/privacy)

= Anthropic Claude =

Used to generate FAQ content via the Claude model you select (e.g. Claude Haiku).

* API endpoint: `https://api.anthropic.com/v1/messages`
* [Anthropic Terms of Service](https://www.anthropic.com/legal/consumer-terms)
* [Anthropic Privacy Policy](https://www.anthropic.com/legal/privacy)

No data is sent to WebTend or any other service. All requests go directly from your server to the AI provider you choose.

== Installation ==

1. Upload the plugin folder to `/wp-content/plugins/`
2. Activate the plugin through the **Plugins** menu
3. Go to **AI FAQ → Settings** and add your AI provider API key
4. Open any page or post and use the **AI FAQ Generator** meta box
5. Save — then add `[wtaf_faq]` anywhere to display your FAQs

== Frequently Asked Questions ==

= Do I need an AI API key? =

Yes. The plugin uses your own API key (BYOK — Bring Your Own Key) to communicate with AI providers. This keeps costs transparent and data private. You can get a key from OpenAI, Google AI Studio, or Anthropic.

= Which AI provider should I use? =

GPT-4o Mini (OpenAI) is the recommended starting point — fast, affordable, and high quality. Gemini 1.5 Flash is the most cost-effective option. Claude Haiku is excellent for detailed technical content.

= Will the FAQs appear in Google search results? =

The plugin automatically injects FAQPage JSON-LD schema, making your FAQs eligible for Google rich results (FAQ snippets). Appearance in search results is at Google's discretion.

= Can I edit the generated FAQs? =

Yes. All generated FAQs appear as editable fields in the meta box before saving. You can modify questions and answers or remove items you don't need.

= How does the live search work? =

The search box filters FAQ items in real time as visitors type — no AJAX, no page reload. It searches both the question and answer text, highlights matched keywords, and announces results to screen readers via an ARIA live region. Use `[wtaf_faq search="no"]` to disable it.

= How do I display FAQs on my page? =

Use the `[wtaf_faq]` shortcode in your content, or add the **AI FAQ Display** Gutenberg block. You can also enable Auto-Append in Settings to automatically add FAQs below page content without a shortcode.

= Can I disable the search box? =

Yes. Add `search="no"` to the shortcode: `[wtaf_faq search="no"]`. You can also customise the placeholder: `[wtaf_faq search_placeholder="Find an answer…"]`.

= Is this plugin GDPR compliant? =

The plugin does not collect personal data. The live search runs entirely in the visitor's browser. API calls pass your page content to your chosen AI provider — please review the privacy policies of OpenAI, Google, and Anthropic for their data handling practices.

= Can I use this with custom post types? =

Yes. Use the `wtaf_meta_box_screens` filter to add your custom post type slugs.

= Can I override the FAQ templates? =

Yes. Copy `faq-accordion.php` or `faq-list.php` from the plugin's `templates/` folder into your theme's root directory and edit freely.

= Can I back up or migrate my FAQs to another site? =

Yes. Go to **AI FAQ → Import / Export** and click **Download Export File**. Choose JSON (best for re-importing) or CSV (best for editing in Excel / Google Sheets). To import on another site, upload the same file on the Import / Export page and choose your duplicate strategy (Replace or Skip).

= Can I import FAQs I wrote myself in Excel? =

Yes. Create a CSV with columns: Post Title, Post URL, Question, Answer. Each row is one FAQ item. Multiple rows with the same Post URL are grouped into one FAQ set. Upload the file on the Import / Export page.

== Screenshots ==

1. Meta box in the post editor — one-click FAQ generation
2. Admin dashboard with quick start guide
3. Settings page — AI provider configuration
4. FAQ Sets management table
5. Frontend accordion display with live search
6. Live search filtering FAQs in real time with keyword highlighting
7. FAQ Schema visible in Google Search Console
8. Import / Export page — JSON and CSV download and upload

== Changelog ==

= 1.0.0 =
* Initial release
* OpenAI, Google Gemini, and Anthropic Claude support (BYOK)
* Live FAQ search with keyword highlighting and ARIA announcements
* FAQ Schema JSON-LD + Microdata injection with JSON_HEX_TAG to prevent script-tag injection
* Shortcode `[wtaf_faq]` with `search`, `search_placeholder`, `style`, `title`, `class`, `post_id` attributes
* Gutenberg block with search attribute support
* Accordion and List display styles
* FAQ Sets management dashboard
* 4 tone options, custom prompt instructions
* Auto-append FAQs below page content via `the_content` filter (enable in Settings)
* `wtaf_schema_enabled` filter for per-post schema control
* Theme template overrides via `locate_template()` (child theme → parent theme → plugin)
* Export all FAQ sets as JSON or CSV (one-click backup and migration)
* Import FAQ sets from JSON or CSV with duplicate detection (Replace / Skip strategies)
* Translation ready with full .pot file

== Upgrade Notice ==

= 1.0.0 =
Initial release of AI FAQ Generator by WebTend.
