A Frequently Asked Question (FAQ) page contains a list of questions and answers pertaining to a particular topic. FAQ pages can have a rich result on Search and an Action on the Google Assistant. The feature is available on desktop and mobile devices.
If your page has a single question and users can submit alternative answers, use QAPage instead. FAQ Structured data can be used for:
"name": "What is the return policy?",
"text": "Most unopened items in new condition and returned within <strong>90 days</strong> will receive a refund or exchange.
Some items have a modified return policy noted on the receipt or packing slip. <a href=http://example.com/returns> Click here </a> to initiate a return.</p>"
"name": "How long does it take to process a refund?",
"text": "We will reimburse you for returned items in the same way you paid for them.
For example, any amounts deducted from a gift card will be credited back to a gift card."
"name": "When will my credit card be charged?",
"text": "We'll attempt to securely charge your credit card at the point of purchase online.
If there's a problem, you'll be notified on the spot and prompted to use another card."}
The FAQPage type indicates that the page is an FAQ with answered questions. There must be one FAQPage type definition per page.
mainEntity (Question): An array of Question elements which comprise the list of answered questions that this FAQPage is about. The Question type defines a single answered question within the FAQ. Every Question instance must be contained within the mainEntity property array.
text (Text): The full answer to the question. The answer may contain HTML content such as links and lists.
Step 1: Create JSON Array
$json = array(
'@context' => "https://schema.org",
'@type' => "FAQPage",
'mainEntity' => array()
Step 2: Create mainEntity Array
Suppose PHP array $items contain questions and answers.
foreach($items as $item)
$questions = array(
'@type' => 'Question',
'name' => $item,
'acceptedAnswer' => array(
'@type' => "Answer",
'text' => $item
Step 3: Create Schema
$schema = '<script type="application/ld+json">';
$schema .= json_encode($json, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
$schema .= '</script>';
You can test your URL using Google Structured Data Testing tool before publishing your web page.