Add Schema Markup to WordPress Without a Plugin (No Yoast, No Rank Math)
Table of Contents
You can add schema markup to WordPress without installing Yoast, Rank Math, or any other SEO plugin. Plugins are convenient but they bloat your site, slow page loads, and lock you into their schema patterns. Hand-coded schema is faster, lighter, and gives you full control. This guide walks through three plugin-free methods, from quickest to most scalable.
Why You Might Skip the Plugin in the First Place
Yoast SEO and Rank Math are great for sites that need schema across hundreds of posts. But for many sites, the trade-off isn't worth it:
- Page weight — Yoast and Rank Math each add 100KB+ of CSS and JS to every page load, even on the front-end
- Schema you can't customize — both plugins generate schema in a specific way; if you want a custom schema type or field, you have to use a hook
- Plugin conflicts — having two SEO plugins active outputs duplicate schema, which Google flags as an error
- Maintenance overhead — every plugin update is a chance for something to break
If you have under 50 posts, or you only need schema on a few key pages, plugin-free is faster. If you have hundreds or thousands of posts and you're not a developer, a plugin is probably the right call. Pick based on scale.
Method 1: Paste Schema Into a Custom HTML Block (Easiest)
This is the fastest method. Works for any single post or page.
- Open your post in the Gutenberg editor
- Click the + button to add a new block, search for "Custom HTML"
- Use our free schema markup generator to build your JSON-LD code
- Copy the entire script tag (including the opening and closing script tags)
- Paste it into the Custom HTML block
- Click "Update" to save the post
Done. The schema is now in your post. View the published page source to confirm — search for "application/ld+json" and you should see your code.
This method is perfect for one-off pages: your homepage with LocalBusiness schema, your services page with Service schema, a few cornerstone blog posts with FAQ or HowTo schema. For 1-10 pages, this is faster than configuring a plugin.
Method 2: Inject Schema via functions.php (Site-Wide)
For schema you want on every page (or every post of a certain type), inject it via your theme's functions.php — but use a CHILD theme so updates don't wipe your code.
Create a child theme if you don't have one. In the child theme's functions.php, add a function hooked into wp_head:
function custom_schema_markup() {
if (is_singular('post')) {
global $post;
$schema = array(
"@context" => "https://schema.org",
"@type" => "BlogPosting",
"headline" => get_the_title($post),
"datePublished" => get_the_date('c', $post),
"dateModified" => get_the_modified_date('c', $post),
"author" => array(
"@type" => "Person",
"name" => get_the_author_meta('display_name', $post->post_author)
),
"image" => get_the_post_thumbnail_url($post, 'full')
);
echo '<script type="application/ld+json">' . wp_json_encode($schema) . '</script>';
}
}
add_action('wp_head', 'custom_schema_markup');
This outputs Article schema on every single post automatically, pulling the title, date, author, and featured image from WordPress. Customize the schema array to match what you need. For pages instead of posts, change is_singular('post') to is_singular('page').
Sell Custom Apparel — We Handle Printing & Free ShippingMethod 3: Custom Page Templates for Specific Page Types
If you have specific page types that need different schema (e.g., your services page needs Service schema, your locations need LocalBusiness, your products need Product), create custom page templates in your child theme.
In your child theme folder, create a file like services-page.php with this header at the top:
<?php /* Template Name: Services Page */ get_header(); ?>
Below the header, add your normal page content output, plus a script tag with the JSON-LD for that page type. When you create a new page in WordPress, you can pick this template from the Page Attributes panel — it'll use your custom schema.
This method scales well for sites with several distinct page types. Build a template per type, assign as needed. No plugin, no per-page manual work.
Validating Your Schema After Adding It
Whichever method you use, always validate after deploying. Two tools:
- Schema Markup Validator (validator.schema.org) — checks general schema.org compliance
- Google Rich Results Test (search.google.com/test/rich-results) — checks if Google can use the schema for rich results
Paste your published page URL into both. If both pass, you're good. If one fails, the error message will tell you what to fix.
After validating, add your site to Google Search Console and watch the Enhancements section. Google reports any schema issues it finds during normal crawling — much more comprehensive than one-off validation.
When You Should Just Use a Plugin
Plugin-free has limits. Use a plugin if:
- You have 100+ posts and want schema on all of them automatically
- You're not comfortable editing PHP files
- You need automatic Article schema with rich content recognition
- You want a UI for managing schema rather than editing code
- Your team includes non-developers who need to manage schema
Yoast and Rank Math both handle this well. The tradeoff is page weight and reduced flexibility. For most sites with content teams, that tradeoff is worth it. For developer-managed sites with limited but high-value pages, plugin-free wins.
Try It Free — No Signup Required
Runs 100% in your browser. No data is collected, stored, or sent anywhere.
Open Free Schema Markup GeneratorFrequently Asked Questions
Is plugin-free schema actually better for SEO?
Not better in terms of schema correctness — Google parses both the same way. Better in terms of page speed (no plugin bloat) and customization control. For sites where page speed matters or where you need non-standard schema, plugin-free wins. For high-volume content sites, plugins are more practical.
Can I have both Yoast and custom schema?
You can, but be careful about duplication. If Yoast outputs Article schema and your custom code also outputs Article schema, Google sees two conflicting blocks. Either disable Yoast's schema for the page types you're handling manually, or augment Yoast's schema with your custom additions instead of replacing.
Do I need to use a child theme?
Yes if you're editing functions.php. Without a child theme, your changes get wiped every time the parent theme updates. Creating a child theme takes about 10 minutes and protects your customizations forever.
Will Custom HTML block schema break if I use a different theme?
No. Custom HTML blocks are part of post content, stored in the database. They survive theme changes. The schema lives with the post, not the theme. This is one of the advantages of Method 1.
Can I add multiple schema types to one page?
Yes. You can have multiple separate script blocks on a page (one for Article, one for FAQ, one for Breadcrumb), or you can combine them in a single script block with @graph. Both work. Google parses all schema on the page.
How do I edit Shopify schema without a plugin?
Shopify uses Liquid templates. Edit theme.liquid or specific template files (product.liquid, collection.liquid) and paste your schema JSON-LD into a script tag. See our Shopify schema guide for the full pattern.

