FAQ Structured Data Markup is something new to our digital life. Google now can display directly in the search results Frequently asked questions about a specific topic. In this article, you will learn how you can implement this new FAQ rich results with Advanced Custom Fields in your WordPress Theme. To follow this tutorial you should have FTP Access to your site and an admin account to install Advanced Custom Fields Pro.
You have to know that the following example will work only inside the Wordpress loop.
Analyze our FAQ Structured Data setup
Our website has an FAQ section and this will be our walk-through for this tutorial. This page was created by using ACF PRO and repeater fields. Our Fields setup Contains, where – is an inheritance indicator.
- A parent repeater named FAQ – Repeater Field
- A child field named FAQ Section Name – – Text Field
- A nested repeater named FAQ Section – – Repeater Field
- A child Text area field of nested repeater named Question – – – Text Area Field
- A child Wysiwyg Editor field of nested repeater named Answer – – – Wysiwyg Editor
So, our Advanced Custom Fields Field editor should look like:
Let’s code those fields
A new page template is the best idea to build our FAQ section. We strongly recommend to follow this way but you can also use other methods like page or post even custom post type but maybe some steps could be a little bit different. So the FAQ fields based on ACF should have this markup in PHP.
[prism url=”https://gist.githubusercontent.com/ifrountas/74c13556a0230a088481254881d4fe02/raw/c858cb6ec895f81915125bfcedc6a5a2eb4808c0/Printing%2520FAQ%2520fields” language=”php”]
Create the FAQ Structured Data Markup
Once our main loop has run we need to create the same loop again in order to get the fields ready for JSON encoding. Notice that we do not want our FAQ Structured Data Markup to appear inside the elements. We want it to the footer of the site for many reasons, mainly because we are going to generate a script. This time our loop should look like:
[prism url=”https://gist.githubusercontent.com/ifrountas/462982b7d4de4cfdcf2817f3a4fba5f0/raw/ba5b5f3d311eb3bbe4cf4eb3e7f3ae21f5fb06a3/asdasda.php” language=”php”]
Put it all together
At the end our FAQ Structured Data ACF loop looks awesome!
[prism url=”https://gist.githubusercontent.com/ifrountas/b259549755221c4e5ebdfce611b946a4/raw/33734dd64f7fc4779fe191b9a91fdb71435d6deb/oasdoiaodias.php” language=”php”]
Testing our page on Google
If everything is working fine in Google Structured Data Testing Tool your site should have no errors in search results.
2023 August Update
Google Changed How FAQ appears on search results
Google made an announcement on August 8, 2023, regarding alterations in the display of FAQ and HowTo rich results. To clarify, FAQ rich results will appear less often in search result snippets, and HowTo rich results will now be exclusively available on desktop devices. Google’s rationale behind this update is to enhance the search experience by ensuring a cleaner and more uniform presentation.
Google said that How-To (derived from HowTo structured data) rich results will exclusively be displayed to desktop users and will not be accessible to those using mobile devices. It’s important to note that, with mobile indexing, Google uses the mobile version of a website for indexing. Therefore, if you want How-To rich results to appear on desktops, you must ensure that the mobile version of your website contains the required markup.
You can read more here.
What we believe about FAQ structured data
We firmly believe that incorporating HowTo schema into your website is a valuable strategy whenever feasible. This action can only bring benefits and ensures you don’t miss out on long-term advantages in the realm of Search Engine Optimization.