With search engines trying harder to understand the context of your website, it’s essential that you become familiar with JSON and how to effectively use it in WordPress in a scalable manner. In the past, we needed to use 3rd party plugins or rely on the generosity of themes to allow us to add JSON code to WordPress posts and pages. But now with Gutenberg, it’s easy as pie!
First, a quick primer.
What is Schema and JSON?
In the context of the most common use case for JSON, it’s a way to describe the information on your site in a format that’s easily accessible to search engines. Say you write a blog post about a certain product. Everyone writes in a different way. Some will use price comparison tables. Others might just mention the price in an ordinary paragraph of text. Some might not even mention the price!
With so many different approaches, it helps if there’s a standardized way of representing text. And that’s where schema comes in. The Google documentation on structured data allows you to specify information about the entity you’re describing in a standardized format so that it can be easily picked up and processed by search engines.
Here are some examples of what you might use schema for:
- Product reviews
- Pricing comparisons
- Frequently Asked Questions and How Tos
- Event details
And a lot more. There are literally hundreds or thousands of structured data formats that you can use. One of the benefits to this, is that you can get enhanced search results in the SERPS. For example, I use structured data on my site WP-Tweaks.com to write about NameHero’s products. Here’s a screenshot of what my SERP looks like for when someone searches for a NameHero coupon or review:
The stars that you see below the search result are automatically generated by Google as it parses my site for structured data. I’ve set up a form submission facility on the site where users can write their own reviews. These are then collated into a specific format that is consumed by search engines and displayed in the SERPS.
And that’s where JSON comes in. JSON is the language we use to talk about structured data.
Inserting JSON Code into WordPress
This isn’t the place to go into details on how to write JSON. Ideally, you would take a sample JSON code and just modify it to suit your needs instead of building a new one from scratch. You can then test your code using Google’s structured data testing tool to identify any syntax errors.
Once your code is ready, you need to insert it into your WordPress post. Luckily with Gutenberg, you just need to create a block called “Custom Code” and then paste your JSON into it anywhere on the page (usually on the bottom). Previously, we need to use themes or plugins to insert additional code like this, but with Gutenberg, placing code snippets is easy as pie. You don’t need any tricks or workarounds.
Once done, simply save your post and invite Google to craw it via the Google Search Console. If everything goes according to plan, you should be able to see your new Google structured data show up in the search results in as little as a few hours!
Using JSON in WordPress can elevate your articles a few notches by providing valuable contextual information that is specially displayed in search engine results. And using WordPress’s Gutenberg, you can do it easily in just a few seconds.
I’m a NameHero team member, and an expert on WordPress and web hosting. I’ve been in this industry since 2008. I’ve also developed apps on Android and have written extensive tutorials on managing Linux servers. You can contact me on my website WP-Tweaks.com!