Key Takeaways
Schema markup is a structural code added to a website that makes content easier to understand for search engines and AI crawlers. It explicitly defines the context of on-page elements, helping machines parse information that might be otherwise difficult for them to understand. For example, an Author tag can help crawlers distinguish between the author of a piece of content and the characters within.
While Schema.org establishes the universally agreed-upon vocabulary major search engines use to understand on-page data, it must be deployed through one of three specific code formats: JSON-LD, Microdata, or RDFa. Google explicitly recommends JSON-LD because it is easier to manage at scale.
Implementing Schema markup does not inherently boost baseline SEO rankings, but it does qualify eligible content to appear as enhanced ārich results.ā These are enhanced search engine results that display star ratings, prices, or event dates to improve visual prominence on SERPs and catch user attention, which can lead to higher organic traffic to your content.
For most WordPress sites, using a plugin is the most efficient and error-free method to implement structured data. Plugins like All In One Rich Schema Snippets, Schema App Structured Data, or KK Star Rating dynamically generate accurate baseline Schema across a site, saving developer time and resources.
Advanced users can implement Schema manually on specific posts or pages. For larger sites, developers can use a tool like Advanced Custom Fields (ACF) to provide a framework that automatically adds accurate, machine-readable data to site content without manually writing code for each individual post or page.
Always validate newly implemented Schema to ensure itās accurate and machine-readable. Tools like Googleās Rich Results Test and the Schema.org Validator can verify that your Schema has been implemented correctly.
The way your website appears in search results certainly influences how many and what types of visitors you receive. Consequently, itās important to seek out ways to enhance how your site is represented by search engines to drive more high-quality traffic your way.
Schema markup can help search engines determine how to index your content accurately. This can help prevent your site from ending up on Search Engine Results Pages (SERPs) for irrelevant searches. In this way, you can drive more high-quality traffic to your website.
In this article, weāll explore what Schema is, how to implement it for your WordPress1Ā® site, and what related resources are available to you. Letās dive in!
What is Schema Markup?
Think of Schema markup as your ābusiness cardā for search engines. It provides context to your content to help crawlers determine what itās about. In the same way a business card tells potential clients your job title, Schema markup tells search engines what things are, so they can be properly indexed.
For example, say you reference the name āJon Snowā in the text on your page. Schema markup tells search engines what this data means: is it the name of the postās Author or a character in a television series the post talks about? By clearly defining the structure of this data, you can present a more representative business card.
Structured data can also make eligible content appear in search results, commonly called rich results. Depending on the type of content, these enhancements may include information such as ratings, prices, event dates, recipe preparation times, or other useful details.
However, adding valid Schema markup does not guarantee that Google or another search engine will display a rich result. Search engines ultimately determine whether an enhanced result is appropriate based on factors such as the content, markup, search query, and overall quality of the page.
What is Schema.org?
Schema.org is an agreed-upon set of vocabulary terms used to describe WordPress website structure and data. Schema.org vocabulary can be implemented using several structured-data formats, including JSON-LD, Microdata, and RDFa. Weāll cover each format in more detail later in this post.
Professional teams from Google, Yahoo, and Bing came together to create consistency in their structure and terminology, so regardless of which format you use to generate your structured data markup, search engines will know what it means because there is a common language used in all of them. Head to Schema.org to learn more about the core vocabulary used in Schema markup.
What Are the Benefits of Adding Schema Markup to Your WordPress Site?
When you add Schema markup code to your WordPress site, you increase the accuracy with which search engines display your site. Take the Jon Snow example aboveāSchema markup keeps your Game of Thrones fansite from appearing in a search for new authors.
You can also leverage Schema to signify your organizationās location. This strategy is especially helpful for brick-and-mortar businesses.
Another potential benefit of adding Schema markup is making eligible pages available for rich results. These enhanced search listings can provide users with useful information before they visit your site, such as ratings, prices, event dates, or recipe details.
Because these results can be more informative and visually prominent than standard search listings, they may help attract qualified visitors. So, what is Schema in website terms? Itās a tool for driving conversions and pageviewsāand everyone should use it.
Schema Markup for SEO
Schema can often be misconstrued as an element that helps boost your websiteās Search Engine Optimization (SEO). While it is true that Schema does optimize how your site appears on Googleās SERPs and how closely your content matches with relevant search queries, it does not inherently increase your rankings.
However, when users can see relevant contextual information about your website more clearly than others on the page, it may influence them to visit your website. Depending on the content type, structured data can make a page eligible for enhanced search features such as ratings, review information, prices, event dates, recipe details, or breadcrumbs.
Above, we see an example of the Fandango app on the App Store/iTunes. It shows how many reviews the app has received, its rating, price, category, and on which devices (iOS) it is supported.
Hereās another example from a Bar-B-Q restaurant that hosts regular events:
Since the website for Stubbās Bar-B-Q uses itemprop=āeventā tags, when we search for āevents stubbs,ā we see a nice list of events, dates, and titles as the first search result.
Remember, while websites using Schema do not get preferential treatment by search engines, they might receive more attention from actual users. The additional data structure helps a user quickly decide whether the information on the page will be relevant to what they need.
Schema Markup Vocabulary Formats
Schema vocabulary can be used to encode data within HTML frameworks. To get a better idea of how some of them work, weāll go over three in detail: JSON-LD, RFDa, and Microdata.
While Schema.org is the resource and repository that documents the agreed-upon sets of Schema vocabulary terms, JSON-LD, Microdata, and RDFa all provide different code frameworks you can use to implement that vocabulary on your site. Regardless of which format you use to generate your markup, search engines will understand it because all three formats use the same Schema vocabulary. Understanding each of these formats may help you choose the right one for your website.
JSON-LD Schema
While Schema vocabulary is supported in several formats, JavaScript Object Notation for Linked Data (JSON-LD) tends to be the most commonly used. In fact, Google explicitly recommends the use of JSON-LD in their documentation.
JSON-LD is a way to embed Linked Data using strictly JSON as a script on your webpages. An example of this format can be found when searching for āhomemade apple pie recipe.ā
JSON-LD schema markup type is what enables all the useful metadataāthe rating, number of reviews, cook time, and calorie countāto appear in the search result. If you use the āView Page Sourceā function on this recipe page, you can see the JSON-LD used to display this information.
Tags such as @type inform us this is a Recipe, and the author tag tells us itās made by a @type tTags such as @type inform users that this is a Recipe, and the author tag shows that itās made by a @type that is an Organization named Land Oā Lakes. Further bits of data such as preparation time, calories, featured image, and rating are also assigned with tags.
JSON-LD Schema Generators
It can be difficult for those unfamiliar with JSON, JavaScript, or HTML to learn how to create snippets containing the metadata they want to display. Fortunately, there are generator tools you can use to create the JSON-LD Schema snippets for your website.
Below are some of the best resources for JSON-LD markup:
- Webcode.tools has a comprehensive generator tool that enables you to add tags for many types of web content and metadata fields.
- The Merkle Schema Markup Generator is a popular markup generator tool that works flawlessly for creating advanced JSON-LD format options like breadcrumbs, articles, events, and local businesses.
- Search Engine Land has also created a free markup generator tool that shows the visual JSON-LD markup and how it changes as you add more information into its fields.
JSON-LD markup can greatly enhance the information delivered by search engines to your potential web site visitors and search engine crawlers, and these resources can make it easier to create and implement your Schema.
Microdata
Microdata is another way to nest metadata within an HTML page. It can be used to give more context to site elements by creating a simpler tagging and inferencing system out of the HTML elements already present on your siteās pages.
Microdata adds structured-data attributes directly to the HTML elements that contain the visible page content.
A basic article heading and publication date might initially look like this:
<article>
<h2>The Trouble with Bob</h2>
<p>Published on September 10, 2011</p>
</article>
To describe this content using Schema.org Microdata, you can add the itemscope, itemtype, and itemprop attributes:
<article
itemscope
itemtype="https://schema.org/Article"
>
<h2 itemprop="headline">
The Trouble with Bob
</h2>
<p>
Published on
<time
itemprop="datePublished"
datetime="2011-09-10"
>
September 10, 2011
</time>
</p>
<p>
By
<span
itemprop="author"
itemscope
itemtype="https://schema.org/Person"
>
<span itemprop="name">Jon Snow</span>
</span>
</p>
</article>
In this example:
- itemscope identifies the HTML element as an item being described.
- itemtype identifies the item as a Schema.org Article.
- itemprop=āheadlineā identifies the articleās headline.
- itemprop=ādatePublishedā identifies its publication date.
- The nested Person item identifies Jon Snow as the articleās author.
Microdata can describe content accurately, but it requires structured data attributes to be added throughout the visible HTML.
For most WordPress sites, JSON-LD is easier to add and maintain because it keeps the structured-data description separate from the pageās presentation markup.
RDFa Schema
Resource Description Framework in Attributes (RDFa) is a way for web developers to bridge the gap between what a human sees on a web page and what a browser or crawler sees. The framework does this by extending the usual HTML attributes without impacting what users see on the web page.
A browser reads web pages via attributes such as headline and text, while you view the rich content in the browser.
When you mark up your site code with RDFa, you give the browser a deeper understanding of your content. Letās look at an example of how RDFa can add machine-readable tags to human-readable content.
Here is a simple piece of HTML displaying blog post content geared toward human consumption:
<html>
<head>
...
</head>
<body>
...
<h2>The Trouble with Bob</h2>
<p>Date: 2011-09-10</p>
...
</body>
In order to help a machine better understand this information, we can add attributes beyond the standard HTML <head> and <body> tags by using RDFa. Keep in mind, RDFa uses full URL links to mark up HTML. This prevents any linguistic misunderstandings about an attribute, as any person or machine can click through to learn about it.
Back to our example. Here it is with RDFa attributes added:
<html>
<head>
...
</head>
<body>
<h2 property="http://purl.org/dc/terms/title">The Trouble with Bob</h2>
<p>Date: <span
property="http://purl.org/dc/terms/created">2011-09-10</span></p>
...
</body>
Now we can see that the post title is annotated with a link to the title and the created attribute using RDFa terms. Any browser or application can now understand what a title is and that āThe Trouble with Bobā is the title of this blog post.
How to Add Schema Markup to WordPress
Now that we have explored what schema markup looks like, you may be wondering how to embed it on your WordPress site. There are a few different ways you can accomplish this task.
Schema Markup WordPress Plugins
Using a plugin to configure your Schema markup is likely the easiest option for most users. There are a number of WordPress plugins to help you create rich meta tags, descriptions, and formatting.
The All in One Rich Schema Snippets plugin enables users to select what each page and post is about for a more structured search engine appearance:
The Schema App Structured Data plugin takes it a step further and automatically configures Schema settings and data on your behalf, including a few high-level details like your logo, address, and type of company. The free version of the Schema App Structured Data automatically generates baseline Schema markup for common WordPress content types, and additional services and paid features are available for users who need advanced customization or more extensive Schema management. You can book a demo and ask for a custom pricing quote on the pluginās website.
There are also plugins focused on specific Schema markup types. For example, KK Star Rating enables users to rate your posts and adds the Schema markup needed to display this information in SERPs.
Plugins like these can automatically add Schema markup to your WordPress website after a few simple configuration settings are saved, so you get the benefits of using Schema without requiring hours of time and effort to implement it.
Option 1: How to Add Schema Markup Manually on Specific Posts and Pages
For most WordPress users, an SEO or structured-data plugin is the easiest way to add Schema markup, as they can generate markup dynamically and reduce the risk of syntax errors.
Before adding custom markup, check whether your theme or an existing plugin already generates structured data. Adding the same Schema type more than once can create duplicate or conflicting information.
Developers who need greater control can add JSON-LD manually using a custom field and a small amount of PHP.
Step 1: Create the JSON-LD
Create the JSON-LD object that describes the page. Do not include the surrounding <script> element when saving the code in the custom field.
For example:
{
"@context": "https://schema.org",
"@type": "Article",
"headline": "A Guide to Adding Schema Markup with WordPress",
"author": {
"@type": "Person",
"name": "Jon Snow"
}
} Only include information that is visible on or accurately describes the page. Do not add ratings, reviews, prices, authors, or other properties that are not supported by the page content.
Step 2: Add the JSON-LD to a Custom Field
Open the WordPress post or page where you want to add the markup.
Click the three-dot menu in the upper right corner, then click Preferences > Panels, and scroll down to the Additional section, where you can toggle on Custom Fields. The exact location and wording may vary depending on your WordPress version, the editor you are using, and your site permissions.
Create a custom field with the following name:
schema_markup
Paste the JSON-LD object into the custom fieldās value and save or update the post.
Saving the JSON-LD in a custom field does not automatically add it to the page source. WordPress must also be instructed to retrieve and print the custom-field value.
Step 3: Output the Markup with WordPress
Add the following PHP to your child themeās functions.php file:
<?php
/**
* Print page-specific JSON-LD stored in the schema_markup custom field.
*/
function wpengine_output_custom_schema_markup(): void {
if ( ! is_singular() ) {
return;
}
$post_id = get_queried_object_id();
$schema = get_post_meta( $post_id, 'schema_markup', true );
if ( empty( $schema ) ) {
return;
}
$decoded_schema = json_decode( $schema, true );
if ( JSON_ERROR_NONE !== json_last_error() ) {
return;
}
printf(
'<script type="application/ld+json">%s</script>' . "\n",
wp_json_encode(
$decoded_schema,
JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE
)
);
}
add_action( 'wp_head', 'wpengine_output_custom_schema_markup' );
This code:
- Runs only on individual posts, pages, and other singular content.
- Retrieves the value of the schema_markup custom field.
- Confirms that the value contains valid JSON.
- Outputs the markup inside a JSON-LD script element in the document head.
- Safely encodes the stored data before printing it.
Avoid editing your parent themeās header.php file directly. Changes made to a parent theme can be overwritten during a theme update, and modern block themes may not use the traditional template-file structure.
Step 4: Test the Page
After publishing the page, test your Schema with Googleās Rich Results Test or the Schema.org Markup Validator.
You should also check the rendered page source to confirm that:
- The JSON-LD appears on the intended page.
- The JSON-LD is valid.
- The markup accurately describes the visible content.
- Another plugin is not generating duplicate or conflicting markup.
For markup that applies to many pages, such as Article, Product, Organization, or Breadcrumb markup, dynamically generating the data through a plugin or template is usually more maintainable than manually entering it on every page.
Option 2: Create Dynamic Schema Using Advanced Custom Fields (ACF)
While manually pasting JSON-LD code into individual WordPress custom fields works for a small handful of pages, it quickly becomes unmanageable as your site grows. If you are using custom post types (such as books, recipes, products, or events), you can use the get_field() function from Advanced Custom Fields (ACF) to automatically inject user-generated content directly into your schema markup.
Using this approach, your schema remains completely dynamic. When an author or editor updates a field in the WordPress backend, the search engine metadata updates instantly.
Step 1: Set Up Your ACF Fields
First, create the custom fields you need using ACF. For example, if you are running a book review site, you might create an ACF Field Group called āBook Dataā containing fields like:
- book_title (Text)
- book_author (Text)
- review_rating (Number)
Step 2: Add the Dynamic JSON-LD Snippet to Your Theme
Instead of hardcoding static text, you will drop a PHP-driven JSON-LD block into your themeās template file (e.g., single-books.php) or hook it into your header via functions.php.
Here is what that looks like:
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "Review",
"itemReviewed": {
"@type": "Book",
"name": "<?php echo esc_attr(get_field('book_title')); ?>"
},
"author": {
"@type": "Person",
"name": "<?php echo esc_attr(get_field('book_author')); ?>"
},
"reviewRating": {
"@type": "Rating",
"ratingValue": "<?php echo esc_attr(get_field('review_rating')); ?>"
}
}
</script>
Why This Matters for Scale
By nesting the get_field() function directly inside the JSON-LD <script> tag, you bridge the gap between human-readable content and machine-readable data. Your content creators never have to look at or touch schema code; they just fill out standard ACF boxes, and your theme handles the technical SEO automatically.
For developers who want to learn more, check out the guide to making WordPress content machine-readable with ACF, MCP, and Schema.org.
How to Test Schema Markup
After adding structured data to your WordPress site, you should test it to confirm that the markup is valid and can be read by search engines.
There are two primary tools you can use: Google Rich Results Test or Schema.org Markup Validator.
Google Rich Results Test
Googleās Rich Results Test checks whether a page is eligible for the structured-data features that Google supports in its search results.
You can test either:
- The URL of a published page
- A code snippet before adding it to your site
The tool reports errors and warnings associated with Google-supported rich-result types. An error may prevent the page from being eligible for a rich result, while a warning usually indicates a recommended property that is missing.
Schema.org Markup Validator
The Schema.org Markup Validator checks structured data against the broader Schema.org vocabulary.
This is useful because Schema.org supports many types and properties that Google does not currently use for rich results. Markup can therefore be valid according to Schema.org even when it is not associated with a Google Search feature.
WP Engine and Schema Markup
Here at WP Engine, our hosting platform for WordPress is finely tuned for your success. Our servers are built for superior site performance to provide the best experience for your users and give your SEO a boost. Ready to get started? Explore our plans today!
- WP Engine is a proud member and supporter of the community of WordPressĀ® users. The WordPressĀ® trademarks are the intellectual property of the WordPress Foundation, and the WooĀ® and WooCommerceĀ® trademarks are the intellectual property of WooCommerce, Inc. Uses of the WordPressĀ®, WooĀ®, and WooCommerceĀ® names in this website are for identification purposes only and do not imply an endorsement by WordPress Foundation or WooCommerce, Inc. WP Engine is not endorsed or owned by, or affiliated with, the WordPress Foundation or WooCommerce, Inc. ā©ļø