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 block with an array
  • Or use @graph to combine multiple entities
  • Avoid conflicting properties between schema types
  • Test combined markup in Google Rich Results Test

{
  "@context": "https://schema.org",
  "@graph": [
    { "@type": "Article", "headline": "..." },
    { "@type": "FAQPage", "mainEntity": [...] },
    { "@type": "BreadcrumbList", "itemListElement": [...] }
  ]
}

Inputs Required

  • Content URL or content text
  • Content type (article, FAQ, tutorial, product, etc.)
  • Author information (name, URL, credentials)
  • Publisher/organization details
  • Images with dimensions
  • Dates (published, modified)
  • Product details (if applicable): price, availability, brand

Output Format


## Schema Markup: [Page Title]

### Selected Schema Type(s)
- Primary: [Type] — Reason: [why this type fits]
- Secondary: [Type] — Reason: [additional coverage]

### Generated JSON-LD
[Complete, valid JSON-LD block ready for injection]

### Validation Checklist
- [ ] JSON syntax valid
- [ ] All required properties present
- [ ] URLs resolve correctly
- [ ] Images meet size requirements
- [ ] Google Rich Results Test: [pass/fail]

### WordPress Integration
- Hook: [wp_head / custom]
- Method: [theme function / plugin / post meta]
- Notes: [any integration considerations]

Anti-Patterns

  • Missing required properties — Incomplete schema won't generate rich results and may trigger Search Console warnings
  • Invisible content in schema — Schema must reflect visible page content; don't add FAQ schema for questions not on the page
  • Duplicate schema from plugins — Multiple SEO plugins can inject conflicting schema; audit and consolidate
  • Hardcoded dates — Always pull dates dynamically from CMS; stale dates hurt freshness signals
  • Missing dateModified — AI systems weight freshness; always include and keep current
  • Over-marking — Don't add schema types that don't match the content; Google penalizes misleading markup
  • Forgetting Speakable — Voice assistants and AI systems use Speakable schema to identify citable sections
  • Testing only in development — Always validate against Google Rich Results Test with the production URL

Table of Contents