FAQ schema is one of the highest-leverage things you can add to a WordPress site for AI search visibility. AI engines like ChatGPT, Perplexity, and Google AI Overviews actively extract structured FAQ data when deciding what to cite.
Most tutorials tell you to install a plugin. You don't need one. Here's how to add FAQPage schema directly using WPCode, which you likely already have installed.
Why FAQ Schema Matters for AI Search
AI crawlers don't just read text. They parse structured data to identify question-answer pairs they can extract cleanly. FAQPage schema in JSON-LD format tells the crawler exactly which content is a question, which is the answer, and that the two belong together.
Without schema, the crawler has to guess. With schema, the extraction is deterministic. For AI citation purposes, deterministic wins every time.
Method 1: WPCode (Recommended for WordPress)
WPCode lets you add custom code snippets scoped to specific posts or pages without touching your theme files. This is the cleanest approach.
Step 1: Install WPCode if you haven't already
Go to Plugins > Add New, search for WPCode, install and activate the free version.
Step 2: Create a new snippet
Go to Code Snippets > Add Snippet. Choose "Header & Footer" type. Give it a name that includes the post title so you can find it later. Example: "FAQ Schema - What is GEO."
Step 3: Paste this template and fill in your questions
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "FAQPage",
"mainEntity": [
{
"@type": "Question",
"name": "YOUR QUESTION HERE",
"acceptedAnswer": {
"@type": "Answer",
"text": "YOUR ANSWER HERE. Write the full answer as plain text.
No HTML tags inside the text value."
}
},
{
"@type": "Question",
"name": "YOUR SECOND QUESTION HERE",
"acceptedAnswer": {
"@type": "Answer",
"text": "YOUR SECOND ANSWER HERE."
}
}
]
}
</script>
Add as many question/answer blocks as needed. Each block follows the same structure.
Step 4: Scope it to the correct post
Under "Insertion," set Location to "Page-Specific" and enter the post ID or URL. This prevents the schema from loading sitewide and causing duplicate FAQ schema errors across pages.
Step 5: Activate and validate
Toggle the snippet to Active and save. Then go to schema.org/schemaorg/tools/schemaorg-testing-tool and paste your page URL. Confirm the FAQPage entity appears with all questions and answers populated correctly.
Method 2: functions.php (For Developers Who Prefer Code)
If you manage your WordPress site via code and want to keep schema generation dynamic, add this to your theme's functions.php or a site-specific plugin:
function add_faq_schema() {
if ( is_single() && get_the_ID() === YOUR_POST_ID ) {
$schema = array(
'@context' => 'https://schema.org',
'@type' => 'FAQPage',
'mainEntity' => array(
array(
'@type' => 'Question',
'name' => 'YOUR QUESTION HERE',
'acceptedAnswer' => array(
'@type' => 'Answer',
'text' => 'YOUR ANSWER HERE.'
)
)
)
);
echo '<script type="application/ld+json">'
. wp_json_encode( $schema, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE )
. '</script>';
}
}
add_action( 'wp_head', 'add_faq_schema' );
Replace YOUR_POST_ID with the actual WordPress post ID (visible in the post editor URL as ?post=XXXX).
Three Rules for FAQ Content That Actually Gets Cited
Rule 1: Every answer must be self-contained.
The answer should make sense without any context from the rest of the article. AI engines extract FAQ answers independently. If yours reference "as mentioned above" or assume prior reading, they won't extract cleanly.
Rule 2: Match the exact query phrasing.
Use the same language your audience types. "What is generative engine optimization?" not "What does GEO mean?" Check Google's People Also Ask for the article topic to find natural question phrasing.
Rule 3: Minimum five questions per page.
Single-question FAQ sections don't trigger FAQPage schema rendering in most AI engines. Five is the practical minimum. Ten is better.
Validate Before Publishing
Run every FAQ schema implementation through two validators before going live:
- Google Rich Results Test:
search.google.com/test/rich-results — confirms Google can parse it
- Schema.org Validator:
validator.schema.org — checks structural validity
Fix any errors flagged before publishing. A broken FAQPage schema is worse than no schema because it can cause crawl errors on the page.
Full AI search optimization checklist for WordPress:
proaisearch.com/robots-txt-ai-crawlers/