AI FAQ Manager
Professional FAQ management for WordPress — create FAQs manually or generate them with AI (OpenAI & Google Gemini), display them in 5 styles, and ship FAQPage structured data for SEO.
1. Introduction
AI FAQ Manager turns FAQ management into a breeze. Instead of pasting shortcode snippets or hand-writing JSON-LD, you get a complete FAQ workspace inside wp-admin: a dedicated FAQ post type, per-item editing with drag & drop ordering, AI-powered question generation from your existing content, groups for organization, five display styles, a native Gutenberg block with a live preview, and automatic FAQPage schema output.
Every FAQ item receives a stable unique ID, so items can be deep-linked (…/page/#afqm-4f2a9b1c8d auto-expands the item) and referenced individually via shortcode.
2. Feature List
| Area | Features |
|---|---|
| AI Generation |
|
| Display |
|
| Management |
|
| SEO |
|
| Integration |
|
| Privacy & Housekeeping |
|
3. Requirements
| Requirement | Details |
|---|---|
| WordPress | 5.8 or higher (tested up to 7.1) |
| PHP | 7.4 or higher (compatible with PHP 8.x) |
| Database | MySQL 5.7+ / MariaDB 10.3+ (WordPress minimum). No custom tables — FAQs are stored as a custom post type. |
| REST API | Must be enabled (WordPress default) — used by the block preview, import and AI features. |
| HTTPS (outbound) | Your server must be able to reach api.openai.com or generativelanguage.googleapis.com for AI generation. |
| API Key | An OpenAI or Google Gemini API key (only required for AI features — everything else works without one). |
| WooCommerce optional | 5.0+ for FAQ support on product pages. |
4. Installation
Method A — WordPress admin (recommended)
- In wp-admin go to Plugins → Add New → Upload Plugin.
- Choose
ai-faq-manager.zipand click Install Now. - Click Activate Plugin.
Method B — FTP
- Unzip
ai-faq-manager.zip. - Upload the
ai-faq-managerfolder to/wp-content/plugins/. - Activate the plugin in Plugins.
On activation the plugin registers the FAQ post type and FAQ Groups taxonomy, flushes rewrite rules and stores default settings. No data is deleted on deactivation.
5. Quick Start
- Open FAQ Manager → Settings and paste your OpenAI or Gemini API key (see section 6).
- Click Test Connection — you should see "Connection successful!".
- Edit any post, page or product and use the FAQ Items meta box: add items manually or click Generate FAQs with AI.
- Save the post — FAQs appear automatically at the bottom (Auto-display is on by default), and JSON-LD schema is output if enabled.
- Optional: insert the FAQs Gutenberg block anywhere for full control over style, colors and source.
6. Getting an API Key
The plugin talks directly from your server to the AI provider. Your key is stored in your own WordPress database and is never sent anywhere except the provider you choose.
| Provider | How to get the key | Key format |
|---|---|---|
| OpenAI | Sign in at platform.openai.com/api-keys, create a key, add credit/billing to your account. | sk-… |
| Google Gemini | Open aistudio.google.com/app/apikey (Google AI Studio) and create an API key. | AIza… |
7. The Admin Interface
After activation you get a FAQ Manager menu in wp-admin with a dedicated, app-style UI:
- FAQs — the FAQ list table with a hero header and live stats (FAQ posts, total Q&A items, groups, content using FAQs). Columns: Shortcode (click to copy), FAQ Items (sortable), Last Modified (sortable).
- Groups — manage FAQ Groups, with the same stats dashboard and a usage tip.
- Settings — four tabs (AI Provider, Display, Generation, Advanced) with an AJAX save, an unsaved-changes guard and persistent active tab.
- A top bar with brand navigation and a Back to WordPress button; the surrounding admin chrome is hidden on plugin screens.
On regular posts/pages/products you get the FAQ Items meta box plus a dismissible notice reminding you to set an API key (admins only).
8. Creating FAQs
FAQs in this plugin are organized in two layers:
- FAQ posts (post type
afqm_faq) — containers with a title that live under FAQ Manager. - FAQ items — the individual question/answer pairs stored on a FAQ post (or on any post, page or product via the meta box).
Add a FAQ post
- Go to FAQ Manager → Add New FAQ.
- Enter a title (e.g. Shipping Questions). The title identifies the collection; it can also be the "source post" for the Gutenberg block.
- In the FAQ Items meta box click Add FAQ Manually and fill in the question and answer. Answers accept basic HTML (links, bold, lists — sanitized with
wp_kses_post). - Drag items by the handle to reorder. Each item shows its stable ID, e.g.
afqm-4f2a9b1c8d, usable as an anchor and in theitemshortcode attribute. - Assign FAQ Groups (optional) and publish.
Attach FAQs to a post, page or product
Open any supported content and use the same FAQ Items meta box. Items added there display on that content (via auto-display, a shortcode, or the block). To get a ready-made shortcode for the current post, use the AI FAQ Manager Gutenberg sidebar (section 13).
9. AI Generation
Where you can generate
| Location | How |
|---|---|
| Post editor (classic) | FAQ Items meta box → Generate FAQs with AI. Generated items replace the current list (save the post to persist them). |
| Gutenberg | AI FAQ Manager sidebar → Generate FAQs with AI, then Save FAQs to Post and update the post. |
| Bulk | FAQ Manager list → select rows → Bulk actions → Generate FAQs with AI. Each selected FAQ post is generated in one batch with a per-post success/failure report. |
What is sent to the AI
By default the post title + first 300 words of content are sent to the selected provider, with an instruction to return a JSON object of the form {"faqs":[{"question":"...","answer":"..."}]}. Responses are validated and sanitized before display.
Custom prompt
Settings → Generation → Custom Prompt. Available placeholders:
| Placeholder | Replaced with |
|---|---|
{max} | Your "Max FAQs" value (1–20) |
{title} | The post title |
{content} | The prepared content section (title + content, or title only in privacy mode) |
{content} changes what is sent — see section 21 for the full data disclosure.Reliability
- Transient API errors (e.g. 5xx/timeouts) are retried automatically up to 2 times with exponential backoff; auth errors (401/403) fail fast.
- Requests are throttled client-side to at most one per second to avoid accidental loops.
- Malformed model output is parsed defensively (raw JSON, fenced JSON, or the first JSON array/object found). Both a top-level JSON array and the
{"faqs":[...]}object wrapper are accepted.
10. Settings Reference
Open FAQ Manager → Settings. Settings are saved with AJAX (a toast confirms the save) and the active tab is remembered in the URL.
Tab: AI Provider
| Option | Description |
|---|---|
| API Key | Your OpenAI (sk-…) or Gemini (AIza…) key. Stored in the afqm_settings option in your database. |
| Test Connection | Sends a tiny test request, verifies a valid FAQ response can be parsed from it, and reports success/failure with the provider's error message if any. |
| AI Model | gpt-6.1-sol (default), gpt-6-astra, gpt-6-luna, gpt-4.1, gpt-4.1-mini, gpt-4o, gpt-4o-mini, gemini-3.5-flash, gemini-3.5-flash-lite, gemini-2.5-flash, gemini-2.5-flash-lite, gemini-2.5-pro. Models retired by their provider are flagged in Settings with a prompt to choose a current one. |
Tab: Display
| Option | Description |
|---|---|
| Display Style | Default style used by auto-display and shortcodes/blocks that don't override it: Accordion, Toggle, Simple List, Grid (2 Columns), Floating Bubble. |
| Color Scheme | Default, Blue, Green, Red, Dark, Minimal, Custom Colors. When Custom is selected a color picker appears for the accent color (default #2271b1). |
| Auto-display | When on (default), FAQ items stored on a post/page/product are appended below its content — unless the content already contains an [afqm_faqs]/[afqm_faq] shortcode or the FAQs block, in which case nothing is appended (no duplicates). |
| SEO Schema | Outputs a FAQPage JSON-LD <script> block in wp_head on singular supported pages that have FAQ items (on by default). |
| Schema Limit | Maximum items included in the schema output. 0 = no limit (up to 50 allowed). |
Tab: Generation
| Option | Description |
|---|---|
| Max FAQs | Upper bound of items requested per generation (1–20, default 5). Also slices oversized AI responses. |
| Send only title to AI | Privacy mode: only the post title is transmitted, not the content. |
| Custom Prompt | Overrides the built-in instruction. Placeholders: {max}, {title}, {content}. |
Tab: Advanced
| Option | Description |
|---|---|
| Cleanup on Uninstall | Opt-in. When enabled and the plugin is later deleted, all FAQ posts, items, groups and settings are removed. When disabled (default), data is kept. See section 22. |
| Export All FAQs (JSON) | Downloads every FAQ post with its items and groups as a JSON file. |
| Import | Upload a JSON file exported by this plugin; new FAQ posts are created. The import reports the number of imported items and any skipped/failed entries. |
11. Displaying FAQs
There are four ways to show FAQs on the frontend:
- Auto-display — items stored on the current post/page/product are appended below the content (Settings → Display → Auto-display).
- Shortcodes —
[afqm_faqs]and[afqm_faq], anywhere (content, widgets, page builders that process shortcodes). See section 12. - Gutenberg block — the FAQs block with a live preview and per-block style/color/source controls. See section 13.
- FAQ post pages & archives — every FAQ post has its own permalink page showing its items, and there is a FAQ archive at
/faqs/plus group archives at/faq-group/….
Behavior details
- Accordion — one item open at a time; Toggle — items open independently.
- Grid — 1–4 columns, collapses to a single column under 768px.
- Floating Bubble — fixed bottom-corner widget with live question search, outside-click-to-close and a "Powered by" footer.
- Deep links — appending an item's ID as a hash (e.g.
#afqm-4f2a9b1c8d) scrolls to the item, auto-expands it, and even opens the bubble widget if the item lives inside one. - Keyboard support — ArrowUp/ArrowDown/Home/End move focus between accordion and toggle buttons.
- Performance — CSS/JS are only enqueued on pages that actually contain FAQs (auto-display, shortcode, block, or FAQ archives).
12. Shortcode Reference
[afqm_faqs] — collection of items
Renders the items of all published FAQ posts (optionally filtered by group), merged into one display.
[afqm_faqs group="shipping" style="accordion" color="blue" columns="2" limit="-1" order="ASC" orderby="menu_order"]
| Attribute | Values | Description |
|---|---|---|
group | group slug | Only include items of FAQ posts in this FAQ Group. Leave empty for all. |
style | accordion (default), toggle, list, grid, bubble | Display style. |
color | default, blue, green, red, dark, minimal, custom | Color scheme. custom uses the accent color set in Settings → Display. |
columns | 1–4 (default 2) | Grid columns (only affects the grid style). |
limit | integer, -1 = all | Number of FAQ posts queried. |
order | ASC (default), DESC | Sort direction. |
orderby | menu_order (default), title, date, modified, ID, rand | Sort field. Unsafe values fall back to menu_order. |
If nothing matches, a localized "No FAQs found." message is shown.
[afqm_faq] — a single FAQ post (or single item)
[afqm_faq id="123"]
[afqm_faq id="123" item="afqm-4f2a9b1c8d" style="toggle"]
| Attribute | Values | Description |
|---|---|---|
id | FAQ post ID (required) | Only published afqm_faq posts are rendered. |
item | stable item ID, e.g. afqm-4f2a9b1c8d | Optional. Renders only that single item — useful for linking one question from anywhere. |
style | same values as above | Display style (default accordion). |
[afqm_faq id="…"] with one click, and the Gutenberg sidebar offers the same for the post being edited.13. Gutenberg Block & Sidebar
The "FAQs" block (afqm/faqs)
Insert the FAQs block from the Widgets category. The editor shows a live, interactive server-rendered preview (iframe-based, compatible with modern WordPress block editors).
| Control | Description |
|---|---|
| FAQ source | Current post — shows the FAQ items attached to the content being edited; or Specific post — pick any post that already has FAQ items from a searchable list. |
| Style | Accordion / Toggle / Simple List / Grid / Floating Bubble (defaults to the site-wide setting). |
| Color | All color schemes (defaults to the site-wide setting). |
| Columns | 1–4, shown only for the Grid style. |
| Refresh | Re-fetches the preview after you edit FAQ items. |
The "AI FAQ Manager" sidebar
Available in the block editor of every supported post type:
- AI Generation — generate FAQs from the current content, save them into the post meta, with status feedback.
- Shortcode — a click-to-copy
[afqm_faq id="…"]for the current post (once saved) plus a tip about the[afqm_faqs]collection shortcode.
14. FAQ Groups
FAQ Groups are a hierarchical taxonomy — like categories — under FAQ Manager → Groups. Use them to organize FAQ posts (e.g. Shipping, Returns, Pricing) and to filter the collection shortcode:
[afqm_faqs group="shipping"]
Groups also have public archive pages at /faq-group/{slug}/ listing their FAQ posts. The Groups screen shows the same stats dashboard as the FAQ list.
15. Import / Export
Export
Settings → Advanced → Export All FAQs (JSON) downloads a file like:
{
"version": "2.0.3",
"exported": "2026-09-18 10:30:00",
"faqs": [
{
"title": "Shipping Questions",
"content": "",
"faqs": [
{ "id": "afqm-4f2a9b1c8d", "question": "How long does shipping take?", "answer": "3–5 business days." }
],
"groups": ["Shipping"],
"menu_order": 0
}
]
}
Import
Choose a JSON file exported by this plugin. Every entry with a title and at least one valid item becomes a new published FAQ post (groups are created and assigned as needed). The result reports how many were imported and lists any skipped entries. Items keep their stable IDs, so anchors keep working across sites.
16. SEO Schema (JSON-LD)
When enabled (default), the plugin outputs a FAQPage JSON-LD block in wp_head on singular pages of supported post types that have FAQ items:
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "FAQPage",
"mainEntity": [
{
"@type": "Question",
"name": "How long does shipping take?",
"acceptedAnswer": { "@type": "Answer", "text": "3–5 business days." }
}
]
}
</script>
- Questions and answers are stripped of HTML before being added to the schema.
- The Schema Limit setting caps how many items are included (0 = all).
- The schema marks up the items attached to the page — it does not duplicate the FAQ posts' own pages' items twice.
- Validate with Google's Rich Results Test.
17. RTL & Multilingual
- RTL-ready — every item is rendered with
dir="auto"so Persian, Arabic, Hebrew and mixed-language content aligns correctly regardless of the site language; the stylesheet uses logical CSS properties (padding-inline-start,inset-inline-end, …). - Translation-ready — all strings use the
ai-faq-managertext domain. A.pottemplate ships in/languages/; translate it with Poedit or Loco Translate.
18. WooCommerce
When WooCommerce is active, product is added to the supported post types automatically:
- Products get the FAQ Items meta box and Gutenberg sidebar.
- Product FAQs are appended below the product content when auto-display is on.
- Product FAQs are included in the FAQPage schema of the product page.
Developers can add more post types with the afqm_supported_post_types filter (section 19).
19. Developer Docs
Constants
AFQM_VERSION // Current plugin version
AFQM_PLUGIN_DIR // Server path to the plugin folder
AFQM_PLUGIN_URL // URL to the plugin folder
AFQM_PLUGIN_BASENAME // plugin_basename of the main file
Data model
| Key | Type | Purpose |
|---|---|---|
afqm_settings | option (array) | All settings (api_key, model, max_faqs, default_style, default_color, custom_color, show_schema, auto_append, privacy_title_only, cleanup_on_uninstall, schema_limit, default_prompt). |
_afqm_faqs | post meta (array) | FAQ items on any supported post: array of { id, question, answer }. Registered with a REST schema and sanitized on save. |
_afqm_faq_count | post meta (int) | Numeric mirror of the item count, kept in sync for sorting. |
afqm_faq / afqm_group | CPT / taxonomy | FAQ container posts (rewrite slug faqs) and hierarchical groups (rewrite slug faq-group). |
Filters
| Filter | Signature | Purpose |
|---|---|---|
afqm_supported_post_types | apply_filters( 'afqm_supported_post_types', array $types ) | Add/remove post types that get the meta box, auto-display, schema and AI generation. |
afqm_schema_data | apply_filters( 'afqm_schema_data', array $schema, int $post_id, array $items ) | Modify or remove the FAQPage JSON-LD before output. |
afqm_generation_prompt | apply_filters( 'afqm_generation_prompt', string $prompt, WP_Post $post ) | Customize the prompt programmatically. |
afqm_generated_faqs | apply_filters( 'afqm_generated_faqs', array $faqs, WP_Post $post ) | Filter AI results before sanitizing/saving. |
afqm_save_generated_faqs | apply_filters( 'afqm_save_generated_faqs', bool $save, int $post_id, array $faqs ) | Return false to only generate (e.g. send results elsewhere) without saving. |
Example: add a custom post type
add_filter( 'afqm_supported_post_types', function ( $types ) {
$types[] = 'documentation';
return $types;
} );
Example: change the schema output
add_filter( 'afqm_schema_data', function ( $schema, $post_id, $items ) {
// e.g. cap the schema at 3 items regardless of settings
$schema['mainEntity'] = array_slice( $schema['mainEntity'], 0, 3 );
return $schema;
}, 10, 3 );
Frontend customization
- All frontend classes are prefixed with
afqm-; the main container is.afqm-faqs. - The Custom color scheme exposes a CSS variable:
--afqm-accent. You can also set it per container to restyle any scheme:.afqm-color-blue { --afqm-accent: #7c3aed; } - Display templates live in
/templates/faq-*.phpand render throughAFQM_Helpers::render_faqs().
20. REST API
All endpoints live under the afqm/v1 namespace and require cookie authentication with a valid REST nonce (the plugin's own admin scripts handle this automatically).
| Endpoint | Method | Permission | Payload | Returns |
|---|---|---|---|---|
/wp-json/afqm/v1/generate | POST | edit_post on the target post |
{ "post_id": 123 } |
Array of generated {id, question, answer} items (saved to the post meta), or a WP_Error. |
/wp-json/afqm/v1/test-connection | POST | manage_options |
{ "api_key": "…", "model": "…" } (optional — falls back to saved settings) |
{ "success": true, "message": "Connection successful!" } |
/wp-json/afqm/v1/bulk-generate | POST | manage_options + edit_post per item |
{ "post_ids": [1,2,3] } |
Map of post_id → { success, faqs?, count?, message? } |
/wp-json/afqm/v1/import | POST | manage_options |
{ "faqs": [ …export format… ] } |
{ success, imported, errors, message } |
/wp-json/afqm/v1/faq-sources | GET | edit_posts |
— | List of posts that have FAQ items: { id, title, type } |
/wp-json/afqm/v1/preview | POST | edit_posts |
{ "attributes": { source, postId, style, color, columns, currentPostId } } |
{ "html": "…", "message": "…" } — server-rendered block HTML for the editor preview. |
21. Privacy & Data
What leaves your server, and when
- Only during explicit AI actions (single generate, bulk generate, test connection) does the plugin contact a third party: the provider configured in Settings (OpenAI or Google Gemini).
- Default payload: the post title and up to 300 words of content, wrapped in the generation prompt.
- Opt-out: enable Send only title to AI to transmit only the title, or simply don't use the AI features — nothing is transmitted without a user clicking a generate/test action.
- Provider responses are stored as FAQ items in your own database. The API key is stored in the
afqm_settingsoption and is only used server-side in API calls.
What stays local
FAQ posts, items, groups, settings, statistics and export/import files are stored entirely in your WordPress database. The plugin has no telemetry, no tracking and no phone-home.
22. Uninstall & Cleanup
- Deactivation never deletes data — it only flushes rewrite rules and records a timestamp.
- Uninstall (delete) behavior depends on Settings → Advanced → Cleanup on Uninstall:
- Off (default): settings timestamps are removed, but FAQ posts, items and groups are kept so you can reinstall later.
- On: all plugin data is deleted on uninstall — FAQ posts, FAQ items attached to any content, FAQ Groups and all settings.
23. Troubleshooting
| Symptom | Cause & fix |
|---|---|
| "API key not configured" | No key saved yet. Set it in Settings → AI Provider, then Test Connection. |
| "API error (401): …" | The key is invalid/revoked, or the account has no billing credit (OpenAI). Create a fresh key. |
| "API error (429) / rate limited" | Too many requests to the provider, or you fired two requests within one second (the plugin's own throttle). Wait a moment and retry. |
| "Failed to parse AI response" | The model returned non-JSON content. Try a stronger model (e.g. GPT-6.1 Sol) or re-run generation; check that your custom prompt still asks for JSON. |
| Generate button is disabled | No API key saved — the button enables automatically once a key exists. |
| FAQs don't appear on a post | Check Auto-display is on, or add [afqm_faqs] / the FAQs block; remember the content already containing a shortcode/block never gets auto-appended. Items with empty question or answer are skipped. |
| Schema doesn't appear | Enable SEO Schema in Settings → Display; the page must be singular, of a supported type, and have at least one valid item; some SEO plugins remove unknown <script type="application/ld+json"> blocks — check with View Source. |
| Preview in the block editor is empty | The source post has no saved items yet — add items (meta box or sidebar) and press Refresh, or pick a different source post. |
| Import says "not a valid export" | The JSON must contain a faqs array (or be an array of entries) as produced by this plugin's exporter. |
| 403 error when saving settings | You must be an administrator (manage_options); some security plugins also block admin-ajax — whitelist it. |
24. Changelog
1.0.0 — 2026-09
- Initial release.
2.0.0 — 2026-09
- AI generation with OpenAI & Gemini, single + bulk, custom prompt, privacy mode.
- Five display styles, seven color schemes + custom accent, floating bubble with search.
- Stable per-item IDs with deep-link auto-expand; click-to-copy shortcodes.
- Native Gutenberg block with live server-rendered preview; Gutenberg generation sidebar.
- FAQPage JSON-LD with item limit; auto-display with duplicate protection.
- FAQ Groups taxonomy, JSON import/export, opt-in uninstall cleanup.
- App-style admin UI with stats dashboard; full i18n (.pot included).
2.0.1 — 2026-10
- Fixed OpenAI response format mismatch: the API now consistently requests and parses the JSON object format
{"faqs":[{"question":"...","answer":"..."}]}. - The response parser accepts both a top-level JSON array and the
{"faqs":[...]}object wrapper, so AI FAQ generation no longer fails or returns empty results. - Test Connection now validates the test response and fails loudly instead of reporting success when no valid FAQ data was parsed.
2.0.2 — 2026-10
- Replaced retired Gemini models (1.5 Pro/Flash, 2.0 Flash) with currently supported ones: Gemini 3.5 Flash, Gemini 3.5 Flash-Lite, Gemini 2.5 Flash, Gemini 2.5 Flash-Lite, Gemini 2.5 Pro.
- Modernized Gemini API handling: key sent via the
x-goog-api-keyheader, propersystemInstruction, Gemini 3 sampling defaults, multi-part response extraction, and finish-reason details on empty responses. - A saved model that is no longer supported is flagged in Settings with a prompt to choose a current one; the "Get Gemini Key" link now points to Google AI Studio.
- Product description clarified: FAQPage schema output does not imply rich-results or People Also Ask placement.
- Added the current GPT-6 family (GPT-6.1 Sol, GPT-6 Astra, GPT-6 Luna) and removed GPT models being shut down on 2026-10-23 (GPT-4 Turbo, GPT-3.5 Turbo); fresh installs now default to GPT-6.1 Sol.
- Updated the OpenAI request for reasoning models:
max_completion_tokens, low reasoning effort, and no unsupportedtemperature, so GPT-6 generation works.
2.0.3 — 2026-10
- Fixed the shortcode copy button on the FAQ list screen: clicking it multiple times no longer copies the "Copied!" label instead of the shortcode.
- Fixed the admin toolbar overlapping the WordPress Publish controls on the FAQ edit screen: the toolbar no longer floats above WordPress publishing controls there, and the block editor offset now tracks the toolbar height continuously.
25. Support & License
Support
- Documentation: https://ascoupon.com/documentation/
- Support portal: https://ascoupon.com/support/
- Backend demo: https://ascoupon.com/demo/wp-login.php
Purchase code support covers setup help, bug fixes and questions about documented features. Customization services and third-party theme conflicts are out of scope but we'll point you in the right direction where we can.
License
Copyright © 2025 Mahmood Dabestani. This plugin is licensed under the GNU General Public License v2 or later (GPLv2+). You may use it on unlimited sites, modify it and create derivative works under the same license. OpenAI and Google Gemini are external services governed by their own terms; you are responsible for your API usage and costs.