How to add schema markup to WordPress

To add schema markup to WordPress, set site-wide defaults on Hydrogen SEO → Schema (for example Article for every post), then choose a specific type for individual pages in their SEO Settings sheet, and validate the result in Google's Rich Results Test. Without a plugin, you print a JSON-LD <script> block into the page head with a small piece of PHP.

Schema markup describes a page to machines: this is a product at this price, this is a recipe with these steps. It can make a page eligible for rich results but does not raise rankings by itself. Which types are still worth the effort is covered in schema types that actually work; this guide covers adding them.

Step by step

1. Match each page type to a schema type

Markup must describe what is visible on the page. A quick map for most sites:

PageSchema type
Blog posts, newsArticle
Whole site identityOrganization
Product pagesProduct
Physical business, contact pageLocalBusiness
Recipe postsRecipe
Webinars, workshopsEvent

2. Check what your site already outputs

Themes, WooCommerce and form or review plugins often print their own JSON-LD. View the source of a post and a product, and search for application/ld+json. Count the blocks and note their @type. Two blocks describing the same thing, such as two Product entries for one product, confuse validators. Decide which source owns each type before adding more.

3. Set site-wide defaults on the Schema screen

  1. Open Hydrogen SEO → Schema.
  2. Fill in your Organization details: name, logo, URL and contact information. Add profile URLs to Organization sameAs; social profiles from Hydrogen SEO → Social are merged in automatically.
  3. Set a default type per post type, such as Article for Posts.
  4. Use smart tags so one rule works on every post: type @ in a field and insert %title% for the headline or %author% for the author.
  5. Save.

4. Override the type on individual pages

Open a page that needs something more specific, such as a tutorial or a product. Open its SEO Settings sheet, go to Schema Markup, choose the type and fill in the fields. Save the page. The per-page choice applies to that page only; your site-wide defaults stay as they are. For question and answer blocks, see FAQ and HowTo schema, and remember Google now shows those rich results far less often.

5. Or add JSON-LD with code

Without a schema plugin, print a block into the head with wp_head. Build the data as a PHP array and let WordPress encode it, which avoids broken JSON from stray quotes:

php
add_action( 'wp_head', function () {
    if ( ! is_front_page() ) {
        return;
    }
    $data = array(
        '@context' => 'https://schema.org',
        '@type'    => 'Organization',
        'name'     => 'Example Coffee Co',
        'url'      => home_url( '/' ),
        'logo'     => 'https://example.com/logo.png',
    );
    echo '<script type="application/ld+json">' . wp_json_encode( $data ) . '</script>' . "\n";
} );

6. Validate before you move on

Test a live URL in Google's Rich Results Test, which shows which rich result types a page qualifies for and lists errors and warnings. Use the Schema Markup Validator at validator.schema.org for types Google has no rich result for. To check a snippet before it goes live, paste it into the JSON-LD validator. The full process is in validate your rich results.

7. Watch the Search Console reports

After Google recrawls, Search Console lists supported types under its enhancement and shopping reports, such as Breadcrumbs, Products or Review snippets, each with valid and invalid item counts. A sudden rise in invalid items usually means a template or plugin change broke a field.

Common mistakes

  • Marking up content that is not on the page. Prices, ratings or FAQs that exist only in the JSON-LD break Google's guidelines and can lead to a manual action.
  • Leaving expired events marked up. Old Event markup with past dates is a frequent source of warnings.
  • Two SEO plugins printing schema. You get duplicate blocks for every page; see fix duplicate meta output.
  • Adding every type you can find. Types with no matching content just add noise to validate and maintain.

Let AI draft it, then review

With a free hydrogenseo.com account connected, Hydrogen SEO can draft schema from a plain-language description of the page, using credits. Treat the draft like any other: check every field against the visible page, then validate. See AI-assisted schema. Everything else on this page works without an account.

Common questions

Does schema markup improve rankings?

Not directly. It can make pages eligible for rich results and easier for machines to read, which can lift clicks, but it is not a ranking factor on its own.

Can a page have more than one schema type?

Yes. Breadcrumbs plus a content type such as Article or Product is the usual combination, and a contact page can carry LocalBusiness plus FAQ.

Which schema format should I use?

JSON-LD. Google recommends it, and it sits in a single script block instead of being woven through your HTML.

Why does the Rich Results Test show no rich result for my page?

Many valid types have no rich result in Google, and eligible markup is still not guaranteed to be shown. Errors listed in the test must be fixed first.