Skip to main content
< All Topics
Print

Schema Markup Generation

name: schema-markup-generation

description: Generate, validate, and inject structured data markup (JSON-LD) for WordPress content including FAQ, HowTo, Speakable, Article, Product, and Review schemas. Schema selection by content type, validation against Google Rich Results, WordPress integration. Use when adding structured data to web content, generating JSON-LD for WordPress, validating Schema markup, or selecting appropriate schema types for content.

Schema Markup Generation

Instructions

Generate valid JSON-LD structured data markup for web content, with a focus on WordPress integration. Schema markup is the primary machine-readable trust signal for both search engines and AI answer engines.

Schema Type Selection

Select schema type(s) based on content type:

Content Type Primary Schema Optional Secondary
Blog post / article Article or BlogPosting Speakable, BreadcrumbList
FAQ page FAQPage Article
Tutorial / how-to HowTo Article, VideoObject
Product page Product Review, AggregateRating, Offer
Review content Review Product, ClaimReview
Organization page Organization LocalBusiness, ContactPoint
Person / author page Person sameAs links
Event listing Event Place, Offer
Recipe content Recipe HowTo, NutritionInformation
Video content VideoObject Article, HowTo
Fact-check content ClaimReview Article

JSON-LD Generation Rules

Structure

  • Always use @context: "https://schema.org"
  • Use @type for the primary schema type
  • Nest related schemas rather than creating separate script blocks where possible
  • Include @id for entities referenced elsewhere on the site

Required Properties by Schema Type

Article / BlogPosting:


{
  "@context": "https://schema.org",
  "@type": "Article",
  "headline": "",
  "author": { "@type": "Person", "name": "", "url": "" },
  "publisher": { "@type": "Organization", "name": "", "logo": { "@type": "ImageObject", "url": "" } },
  "datePublished": "",
  "dateModified": "",
  "image": "",
  "description": ""
}

FAQPage:


{
  "@context": "https://schema.org",
  "@type": "FAQPage",
  "mainEntity": [
    {
      "@type": "Question",
      "name": "",
      "acceptedAnswer": { "@type": "Answer", "text": "" }
    }
  ]
}

HowTo:


{
  "@context": "https://schema.org",
  "@type": "HowTo",
  "name": "",
  "description": "",
  "totalTime": "",
  "step": [
    { "@type": "HowToStep", "name": "", "text": "", "image": "" }
  ]
}

Speakable:


{
  "@context": "https://schema.org",
  "@type": "Article",
  "speakable": {
    "@type": "Speakable",
    "cssSelector": [".article-summary", ".article-headline"]
  }
}

Product:


{
  "@context": "https://schema.org",
  "@type": "Product",
  "name": "",
  "description": "",
  "image": "",
  "brand": { "@type": "Brand", "name": "" },
  "offers": {
    "@type": "Offer",
    "price": "",
    "priceCurrency": "USD",
    "availability": "https://schema.org/InStock",
    "url": ""
  }
}

Validation Process

  1. Syntax validation: Verify JSON-LD parses without errors
  2. Schema.org compliance: Check all properties are valid for the declared type
  3. Google Rich Results Test: Validate against https://search.google.com/test/rich-results
  4. Required properties: Confirm all required fields for the target rich result are present
  5. URL verification: Ensure all URLs in the markup resolve correctly
  6. Image requirements: Confirm images meet minimum size requirements (1200×630 for Article)

WordPress Integration Patterns

PHP Output in Theme


function output_schema_markup() {
    $schema = [
        '@context' => 'https://schema.org',
        '@type'    => 'Article',
        'headline' => get_the_title(),
        'author'   => [
            '@type' => 'Person',
            'name'  => get_the_author(),
        ],
        'datePublished' => get_the_date('c'),
        'dateModified'  => get_the_modified_date('c'),
    ];
    echo '<script type="application/ld+json">' . wp_json_encode($schema, JSON_UNESCAPED_SLASHES) . '</script>';
}
add_action('wp_head', 'output_schema_markup');

Plugin-Based Injection

  • Use wp_head action hook for page-level schema
  • Store custom schema in post meta for per-post overrides
  • Merge site-wide Organization schema with page-specific schema
  • Avoid duplicate schema from multiple plugins (audit with browser DevTools)

Multi-Schema Pages

When a page qualifies for multiple schema types:

  • Use a single
Table of Contents