How to Add Structured Data/Schema in WordPress (Plugin Options)

October 29, 2025
How to Add Structured Data/Schema in WordPress (Plugin Options)

How to Add Structured Data (Schema Markup) in WordPress

Structured data (or schema markup) helps search engines better understand your content — improving how your site appears in search results with rich snippets such as star ratings, FAQs, breadcrumbs, or product details. In this guide, you’ll learn how to add structured data in WordPress using both plugins and custom options.

What Is Structured Data?

Structured data uses a standardized vocabulary — Schema.org — to describe your content in a machine-readable way. For example, it can tell Google that a page represents a product, article, event, recipe, or organization.

Structured data is most commonly implemented in JSON-LD format, recommended by Google. Example:

{
  "@context": "https://schema.org",
  "@type": "Article",
  "headline": "How to Add Structured Data in WordPress",
  "author": {
    "@type": "Person",
    "name": "John Doe"
  },
  "datePublished": "2025-10-29",
  "publisher": {
    "@type": "Organization",
    "name": "WP Code Tips"
  }
}

Why Structured Data Matters

  • Enhances appearance in search results (rich snippets).
  • 📈 Improves click-through rates (CTR).
  • 🧭 Helps search engines understand your site hierarchy — useful for articles, products, and FAQs.
  • 🎯 Supports voice search and Google’s knowledge panels.

Method 1: Use an SEO Plugin (Recommended)

The easiest way to implement schema markup in WordPress is through SEO plugins that generate structured data automatically for each post or page type.

Option 1: Rank Math SEO

  1. Install and activate Rank Math from Plugins → Add New.
  2. Go to Rank Math → Titles & Meta → Posts.
  3. Select a default Schema Type (e.g., “Article”, “BlogPosting”).
  4. For individual posts, open the Rank Math panel → “Schema” tab to customize fields like headline, author, image, and publisher.

Rank Math supports advanced schema types including Product, Recipe, Event, FAQ, HowTo, and LocalBusiness.

Option 2: Yoast SEO

  1. Install Yoast SEO and activate it.
  2. Go to SEO → Search Appearance → General.
  3. Under “Knowledge Graph,” set your site type (Person or Organization) and logo.
  4. Yoast automatically generates Article schema for posts and WebPage schema for pages.

You can extend Yoast schema with plugins like Yoast SEO Structured Data Blocks for FAQ and HowTo content.

Option 3: All in One SEO (AIOSEO)

  1. Install All in One SEO.
  2. Navigate to Search Appearance → Content Types.
  3. Choose schema types like Article, Product, FAQ, or Recipe.
  4. For each post, use the “Schema” tab in the AIOSEO settings to modify structured data details.

Method 2: Use a Dedicated Schema Plugin

If you want more flexibility without full SEO features, use a plugin dedicated to schema management.

Schema & Structured Data for WP & AMP

  • Supports over 35 schema types (e.g., Article, Event, Review, Product).
  • Works with AMP pages.
  • Integrates with ACF and WooCommerce.

Setup:

  1. Install Schema & Structured Data for WP & AMP.
  2. Go to Structured Data → Schema Types.
  3. Choose your content types (Posts, Pages, CPTs) and assign schema templates.

WP SEO Structured Data Schema

  • Lightweight and easy to configure.
  • Ideal for simple article or business markup.

After installing, edit a post and scroll down to the “Structured Data” box to fill in schema details.


Method 3: Add Schema Manually (Custom JSON-LD)

If you prefer full control, you can add JSON-LD manually using a wp_head hook in your theme’s functions.php file.

<?php
// Add custom Article schema markup
add_action( 'wp_head', function () {
  if ( is_single() ) {
    global $post;
    $schema = [
      '@context' => 'https://schema.org',
      '@type'    => 'Article',
      'headline' => get_the_title( $post ),
      'datePublished' => get_the_date( 'c', $post ),
      'dateModified'  => get_the_modified_date( 'c', $post ),
      'author'  => [
        '@type' => 'Person',
        'name'  => get_the_author_meta( 'display_name', $post->post_author ),
      ],
      'publisher' => [
        '@type' => 'Organization',
        'name'  => 'WP Code Tips',
        'logo'  => [
          '@type' => 'ImageObject',
          'url'   => get_theme_file_uri( '/assets/images/logo.png' ),
        ],
      ],
    ];
    echo '<script type="application/ld+json">' . wp_json_encode( $schema, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ) . '</script>';
  }
} );

This outputs structured data dynamically for each post. You can adjust it for Product, Event, or FAQPage types as needed.


Testing Your Schema

After implementing schema, always test it with Google’s free tools:

These tools will show if your JSON-LD is valid and whether Google can generate rich results from it.


Best Practices

  • ✅ Use JSON-LD format (not Microdata).
  • ✅ Ensure the schema matches visible content (no hidden data).
  • ✅ Avoid duplicate or conflicting schema types (especially if using multiple plugins).
  • ✅ Test after every theme or plugin change.
  • ✅ Keep your organization and logo schema consistent site-wide.

Conclusion

Adding structured data in WordPress doesn’t have to be complex. For most users, SEO plugins like Rank Math or Yoast SEO provide automated, valid schema generation out of the box. For developers or power users, adding custom JSON-LD manually offers full flexibility. Whatever your approach, structured data helps boost visibility, CTR, and user trust — making it an essential SEO enhancement for every WordPress site.

Avatar

Written by

satoshi

I’ve been building and customizing WordPress themes for over 10 years. In my free time, you’ll probably find me enjoying a good football match.