How to Add Schema Markup to WordPress (3 Methods)

Written by Ivan P. | Jan 1, 1970 12:00:00 AM

Schema markup is one of the highest-ROI changes you can make to a WordPress site. It takes 10 minutes to add, costs nothing, and makes your content eligible for rich results in Google Search — star ratings, FAQs, product prices, and more.

This guide covers three ways to add schema markup to WordPress, from the fastest (AI generator) to the most flexible (manual JSON-LD).

What Is Schema Markup and Why Does It Matter for WordPress?

Schema markup is structured data — code you add to your pages that tells Google what your content is about. Not just what the words say, but what type of content it is: a local business, a product, an FAQ, a blog post.

Google uses this data to power rich results: enhanced listings in search that show extra information directly in the results page. A WordPress site with schema can show:

  • Star ratings and review counts on products or services
  • FAQ answers expanding directly in search results
  • Article publish dates and author names
  • Local business hours and address
  • Event dates and locations

Without schema, Google has to guess. With it, you tell Google exactly what to display.

Method 1: Use a Schema Generator (Fastest)

The fastest way to add schema markup to any WordPress page is to generate the JSON-LD with a tool and paste it directly into your page's <head>.

Step 1: Generate the JSON-LD

Go to SchemaGenerator.app, paste your WordPress page URL, and click Generate Schema. The AI reads your page and automatically extracts the relevant fields — your business name, address, opening hours, or article headline depending on your content type.

Review the output, edit anything needed, and copy the JSON-LD snippet.

Step 2: Add it to WordPress

You have a few options for where to paste the code:

Option A — Using a plugin (recommended for non-developers)
Install WPCode. Go to Code Snippets → Add Snippet, paste your JSON-LD, set location to "Header", and activate.

Option B — Using Yoast SEO or RankMath
Both plugins have a "Schema" tab in the page editor. You can use their built-in schema options, or add custom JSON-LD via their custom code fields.

Option C — Using Elementor or other page builders
Add an HTML widget anywhere on the page and paste the JSON-LD <script> tag. Note: this places it in the body, not the head — Google accepts body placement too.

The JSON-LD looks like this:

<script type="application/ld+json">
{
  "@context": "https://schema.org",
  "@type": "LocalBusiness",
  "name": "Your Business Name",
  "address": {
    "@type": "PostalAddress",
    "streetAddress": "123 Main St",
    "addressLocality": "City",
    "postalCode": "12345"
  },
  "telephone": "+1-555-000-0000",
  "openingHours": "Mo-Fr 09:00-17:00"
}
</script>

Method 2: Use a WordPress SEO Plugin (Most Automated)

If you're already using Yoast SEO, RankMath, or Schema Pro, these plugins can auto-generate schema markup for your WordPress content types.

Using Yoast SEO

Yoast adds basic Organization, WebSite, and Article schema automatically on install. To configure:

  1. Go to SEO → Search Appearance → General
  2. Set your organisation name and logo (used for Knowledge Panel)
  3. For individual posts/pages, use the Schema tab in the Yoast sidebar to set the page type (Article, WebPage, FAQ, etc.)

Limitation: Yoast's schema is decent for basics but limited on rich schema types like Product or detailed LocalBusiness.

Using RankMath

RankMath has more granular schema control:

  1. Go to RankMath → Titles & Meta
  2. Choose a content type (Posts, Pages, Products)
  3. Set the default schema type per content type
  4. On individual posts, use the Schema tab in the RankMath panel to add FAQ, HowTo, or Article schema

RankMath's free version covers most schema types. The pro version adds rich snippets and schema validation.

Using Schema Pro

Schema Pro is a dedicated schema plugin (paid, ~$79/yr). It's the most complete option if schema is a priority:

  • Supports 20+ schema types
  • Maps WordPress custom fields to schema properties
  • Auto-applies schema to content types (all products, all posts, etc.)

Method 3: Add JSON-LD Manually to Your Theme (Most Control)

For developers or sites with custom themes, you can add schema markup directly to your WordPress theme files.

Adding to functions.php

function add_schema_markup() {
  if ( is_front_page() ) {
    echo '<script type="application/ld+json">
    {
      "@context": "https://schema.org",
      "@type": "Organization",
      "name": "Your Business",
      "url": "' . get_site_url() . '"
    }
    </script>';
  }
}
add_action( 'wp_head', 'add_schema_markup' );

Tip: Use a child theme to avoid losing changes on theme updates.

Which Method Should You Use?

MethodBest forTime to set up
AI generator + pasteAny WordPress site, any schema type5 minutes
Yoast / RankMathSites already using these plugins10–15 minutes
Schema ProSites needing schema across all content types30 minutes
functions.php / header.phpDevelopers with custom requirements20 minutes

For most WordPress sites, the fastest path is: generate the JSON-LD with SchemaGenerator.app, then paste it using WPCode. You get full control over the output and you're done in under 10 minutes.

How to Verify Your Schema Is Working

After adding schema to WordPress, validate it:

  1. Google Rich Results Test — go to search.google.com/test/rich-results, paste your URL, and check for errors
  2. Schema Markup Validator — at validator.schema.org for full schema.org compliance checking
  3. Google Search Console — after a few days, check the Enhancements section for any schema errors Google found on your live site

Frequently Asked Questions

Does adding schema to WordPress improve my rankings?
Schema is not a direct ranking factor but it enables rich results, which increase click-through rates. More clicks at the same position = more organic traffic. For local businesses, schema also reinforces signals used in Maps rankings.

Can I add schema to specific pages only?
Yes. Using a plugin like WPCode, you can use display rules to show schema on specific pages, post types, or categories. Or generate the JSON-LD for each page individually and paste it into that page's head section.

Is WooCommerce Product schema handled automatically?
WooCommerce adds basic Product schema by default, but it's incomplete — it often misses aggregateRating, brand, and offers properties that Google requires for rich results. Use a dedicated schema generator to produce a complete Product JSON-LD and add it alongside WooCommerce's output.

What's the best free schema plugin for WordPress?
For most sites: RankMath (free tier covers the main schema types) paired with a generator for custom schema. For pure JSON-LD control with no plugin overhead: generate with SchemaGenerator.app and paste via WPCode.

Generate your WordPress schema now — SchemaGenerator.app. No account required, valid JSON-LD in seconds.