How to Add Schema Markup in WordPress
To add schema markup in WordPress, either set schema types in one SEO plugin such as Yoast, Rank Math or SEOPress, or print a JSON-LD block on the wp_head hook from a child theme using wp_json_encode(). Mark up only what the page visibly shows, keep one source per type, and validate the live URL in Google's Rich Results Test.
For WordPress site owners and developers adding structured data to posts, pages and WooCommerce products.
knowledge
- Read time
- 4 min
- Sections
- 8
- Updated
- 14 Nov 2026
- Written by
- WebJi® team
Last editorial update: 14 November 2026.
What does schema markup do on a WordPress site?
Schema markup is structured data, usually JSON-LD in the page head, that tells search engines what a page is about — an article, a local business, a product — in the shared schema.org vocabulary. Valid markup can make a page eligible for rich results; it does not guarantee them or improve rankings by itself.
WordPress core adds almost no schema. Most sites get it from an SEO plugin, a theme, or a small block of code. Use one source per type, because two plugins printing different Organization details confuse more than they help.
Which schema types should a WordPress site use?
Use Organization (or LocalBusiness) and WebSite site-wide, Article on posts, Product on WooCommerce products, and BreadcrumbList for navigation — each only where the page visibly shows those facts. One primary type per page keeps the graph clear.
| Page | Primary type | Rich result potential |
|---|---|---|
| Home and every page | Organization or a LocalBusiness subtype, plus WebSite | Logo and knowledge panel signals |
| Blog post | Article / BlogPosting | Better headline, date and image display |
| WooCommerce product | Product with Offer | Price, availability and reviews in results |
| Any page with a trail | BreadcrumbList | Breadcrumb path instead of URL |
| Event page | Event | Event listings |
| Visible Q&A section | FAQPage | Limited: Google shows FAQ rich results mainly for authoritative government and health sites |
Google narrowed FAQ rich results and removed HowTo rich results in 2023, so FAQ markup now mainly helps clarity rather than appearance.[2]
How do you add schema with an SEO plugin?
Install one SEO plugin such as Yoast SEO, Rank Math or SEOPress, complete its setup to output Organization and WebSite, set default types for posts and pages, and add specific types on individual pages from the editor sidebar. This is the right route when non-developers edit the site.
- Run the plugin's setup wizard and enter the business name, logo and social profiles.
- Set posts to Article and pages to WebPage as defaults.
- On a key page, open the plugin's schema panel and choose the specific type, for example LocalBusiness on the contact page.
- Fill only fields you can verify; wrong values are worse than empty ones.
- View page source and search for
application/ld+jsonto confirm output.
How do you add JSON-LD without a plugin?
Print a JSON-LD script on the wp_head hook from a child theme's functions.php or a code-snippets plugin, building the data as a PHP array and encoding it with wp_json_encode(). Never edit the parent theme; updates overwrite it.
<?php
add_action( 'wp_head', function () {
if ( ! is_page( 42 ) ) { // only on the page with ID 42
return;
}
$data = array(
'@context' => 'https://schema.org',
'@type' => 'LocalBusiness',
'name' => 'Example Salon',
'telephone' => '+91-141-0000000',
'url' => home_url( '/' ),
'address' => array(
'@type' => 'PostalAddress',
'streetAddress' => 'Shop 1, Example Road',
'addressLocality' => 'Jaipur',
'addressRegion' => 'Rajasthan',
'postalCode' => '302021',
'addressCountry' => 'IN',
),
);
echo '<script type="application/ld+json">' . wp_json_encode( $data, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ) . "</script>\n";
} );
Target pages by ID with is_page( 42 ), a post type with is_singular( 'product' ), or a template with is_page_template( 'page-contact.php' ). If your SEO plugin already prints LocalBusiness, disable that output or skip this snippet.
How do you test schema markup in WordPress?
Clear the cache, run the live URL through Google's Rich Results Test, check the full graph in the Schema Markup Validator, then watch Search Console's enhancement reports for a few days. A cached old page is the most common reason a fix seems not to work.
- Purge the page cache and any CDN cache for the URL.
- Rich Results Test: fix every error before looking at warnings.
- Schema Markup Validator (validator.schema.org): confirm there is one Organization and no duplicate types.
- Search Console: review the relevant enhancement report after Google recrawls.
What schema errors do WordPress sites usually hit?
Most problems are duplicates from two sources, broken JSON from hand-typed strings, caches serving old HTML, and markup describing content no longer on the page. Each has a direct fix.
| Symptom | Cause | Fix |
|---|---|---|
| Two Organization nodes with different names | Plugin plus theme or manual block | Keep one source; turn off the other |
| JSON parse error | Unescaped quotes, or a PHP notice printed inside the script | Build arrays and use wp_json_encode(); fix the notice |
| Markup in source but not in the test | Page or CDN cache | Purge, then re-test |
| Mismatch warnings for FAQs or ratings | Schema lists content the page no longer shows | Make markup follow the visible page |
| Product missing price | Variable product with no default variation price | Set prices on variations; let WooCommerce output Offer data |
Google's rule is simple: mark up only content visible to users.[1]
Where should you test schema changes safely?
Test code changes on a staging copy first, because a PHP error in functions.php can take down the whole site. A WordPress staging site lets you check the output before going live.
WebJi® WordPress hosting supports staging and file access for the child-theme route. If you want schema planned with the content, the WordPress SEO service covers both; email support@webji.services with the URL and type you need.
Sources
- Google Search Central, General structured data guidelines.
- Google Search Central Blog, Changes to HowTo and FAQ rich results (August 2023).
Frequently asked questions
Does schema markup improve Google rankings?
Not directly. It helps search engines understand the page and can make it eligible for rich results, which may improve click-through. Content quality and links still decide rankings.
Can I use two SEO plugins for schema?
Avoid it. Two plugins usually print overlapping Organization, WebSite and Article nodes with different details. Choose one plugin for SEO and schema, and switch off schema output in any other plugin or theme.
Does WooCommerce add Product schema automatically?
Yes, WooCommerce outputs basic Product and Offer data for product pages, and SEO plugins can extend it. Check one simple and one variable product in the Rich Results Test, because variable products often miss price data.
Is it worth adding FAQPage markup now?
For most business sites it no longer produces a visible FAQ rich result, but it is harmless when the questions are visible and can help other systems read the page. Do not add hidden questions just for markup.
Checked against Google Search Central on 15 November 2026 · Reviewed by the WebJi® team, Jaipur.
Ready to get started with WebJi®?
Join 12,000+ businesses across India and overseas. INR pricing, 18% GST shown before payment and 24/7 email support in Hindi and English — average first reply under 60 minutes.