WordPress Schema Integration
WordPress outputs JSON-LD through SEO plugins, theme functions, or a small custom plugin. Pick the path that matches your team's skill level and how much control you need over field mapping.
Option 1: SEO plugin
Plugins such as Yoast SEO and Rank Math generate Organization, Article, and breadcrumb markup automatically.
- Install and configure the plugin's schema settings
- Set site name, logo, and social profiles in plugin options
- Review generated JSON-LD on a sample post and your homepage
- Validate with Google Rich Results Test
Use this when default mappings cover your page types. Override or extend when WooCommerce products or custom post types need specific types.
Option 2: Theme hooks
Add JSON-LD in functions.php or a child theme:
add_action('wp_head', function () {
if (!is_front_page()) return;
$schema = [
'@context' => 'https://schema.org',
'@type' => 'Organization',
'name' => get_bloginfo('name'),
'url' => home_url('/'),
];
echo '<script type="application/ld+json">' .
wp_json_encode($schema, JSON_UNESCAPED_SLASHES) .
'</script>';
});
Build the array from post meta, ACF fields, or WooCommerce product data. Use wp_json_encode for safe output.
Option 3: Custom plugin
Create a plugin when multiple post types need different schema builders or when you want version-controlled logic separate from the theme.
Common schema types
| Page | Schema type | Key fields |
|---|---|---|
| Homepage | Organization | name, url, logo, sameAs |
| Blog post | Article | headline, author, datePublished |
| WooCommerce product | Product | name, image, offers, sku |
Generate field values with the Schema Generator, then wire them to WordPress data.
Checklist before launch
- Confirm
wp_head()exists in your theme - Test one URL per template (home, post, product)
- Resolve plugin conflicts by testing with a default theme
- Monitor Google Search Console after deploy
See also CMS Integrations for cross-platform workflow steps.
