When a WordPress site shows up in search results, most listings look the same — a title, a URL, and a short description. That’s fine for basic visibility, but it leaves a lot of information that search engines could use sitting unused. Schema markup is how you provide that information in a structured format search engines can actually process.
It won’t transform your rankings on its own, but it supports everything else you’ve done for SEO by giving Google a clearer picture of what each page is, who wrote it, and what it contains. On sites I build without a heavyweight SEO plugin, I add schema directly through functions.php — it’s clean, lightweight, and doesn’t rely on a third party to stay maintained.
Quick Answer
Schema markup is structured data added to your pages in JSON-LD format. In WordPress, you can add it via a plugin or directly through your theme’s functions.php file. Use Article schema for posts, WebSite schema for the homepage. Validate with Google’s Rich Results Test after adding it.
What Schema Markup Actually Does
Schema tells search engines things your page content alone can’t reliably communicate — that a post is an article, who the author is, when it was published, and what type of content it contains. This information sits in the <head> of your HTML as a JSON-LD block, invisible to readers but fully readable by search engines.
When schema is present and accurate, Google can use it to enable rich results — things like article metadata, breadcrumb paths, or FAQ entries appearing directly in search listings. It doesn’t guarantee these features appear, but it makes your pages eligible for them. Google’s own documentation on how structured data works explains what types are supported and how they’re evaluated.
Adding Schema via functions.php
If your site doesn’t use an SEO plugin — or you want full control without plugin overhead — you can output schema directly from your theme’s functions.php file. This is the approach used on this site: JSON-LD injected into the page head via wp_head, with no plugin dependency.
Article Schema for Posts
Add this to your functions.php to output Article schema on all single posts:
function my_article_schema() {
if ( is_single() ) {
global $post;
$schema = array(
'@context' => 'https://schema.org',
'@type' => 'Article',
'headline' => get_the_title(),
'datePublished' => get_the_date( 'c' ),
'dateModified' => get_the_modified_date( 'c' ),
'author' => array(
'@type' => 'Person',
'name' => get_the_author_meta( 'display_name', $post->post_author ),
),
);
echo '<script type="application/ld+json">' . wp_json_encode( $schema ) . '</script>';
}
}
add_action( 'wp_head', 'my_article_schema' );
You can extend this with a publisher object containing your site name and logo URL, which helps Google associate the article with your brand in search results.
WebSite Schema for the Homepage
Add a separate function for your homepage:
function my_website_schema() {
if ( is_front_page() ) {
$schema = array(
'@context' => 'https://schema.org',
'@type' => 'WebSite',
'name' => get_bloginfo( 'name' ),
'url' => home_url(),
);
echo '<script type="application/ld+json">' . wp_json_encode( $schema ) . '</script>';
}
}
add_action( 'wp_head', 'my_website_schema' );
Keep each schema type in a separate function so they’re easy to modify individually without touching unrelated schema blocks.
FAQ Schema for Question-and-Answer Content
FAQ schema is worth adding to posts that contain a genuine question-and-answer section. Don’t add it to every post as a tactic — only use it where the page visibly answers specific questions. A basic FAQ schema block looks like this:
function my_faq_schema() {
if ( is_single() && has_tag( 'faq' ) ) {
$schema = array(
'@context' => 'https://schema.org',
'@type' => 'FAQPage',
'mainEntity' => array(
array(
'@type' => 'Question',
'name' => 'Your question here',
'acceptedAnswer' => array(
'@type' => 'Answer',
'text' => 'Your answer here',
),
),
),
);
echo '<script type="application/ld+json">' . wp_json_encode( $schema ) . '</script>';
}
}
add_action( 'wp_head', 'my_faq_schema' );
In practice, hardcoding FAQ content into functions.php only makes sense for a single page. For sites with multiple FAQ posts, it’s more maintainable to store the Q&A in custom fields and pull them into the schema dynamically.
Practical Tips
Match schema type to page content. Article for posts, WebSite for the homepage. Don’t apply HowTo or FAQ schema unless the page actually contains that content — mismatched schema produces validation errors or gets ignored.
Validate after adding. Use Google’s Rich Results Test at search.google.com/test/rich-results to confirm schema is detected correctly and check for any errors. Run it after the initial setup and again after any changes.
Check for duplicates before adding. If your theme or any plugin already outputs schema, adding more via functions.php can create duplicate blocks. Search the page source for application/ld+json before adding anything new.
Don’t expect instant changes. Schema won’t produce rich results the moment it’s added. Google needs to recrawl the page and process the markup — this can take days or weeks depending on your crawl frequency.
Common Mistakes
Adding schema types that don’t match the page. Review schema on a page with no reviews, or FAQ schema on a page with no questions — search engines cross-reference markup against visible content. Mismatched schema can trigger manual actions in severe cases.
Ignoring validation errors. Even small formatting issues in the JSON-LD output can prevent rich results from appearing. Always validate after any change.
Adding duplicate schema. If you install an SEO plugin on a site that already has functions.php schema, you may end up with two Article blocks on every post. Remove whichever one you’re not actively maintaining.
When to Use a Plugin Instead
The functions.php approach works well for sites with a consistent content structure and a developer comfortable editing theme files. If you want to manage schema per-post through the editor UI — setting different schema types on different posts without touching code — a plugin like Rank Math gives you that flexibility through its Schema Generator panel.
For most content sites publishing a single content type (blog posts or tutorials), the functions.php approach is simpler to maintain long-term and avoids the overhead of a full SEO plugin if you’re handling other SEO tasks manually. The heading structure of your posts also plays into how search engines interpret your content alongside schema, so it’s worth getting both right.
Conclusion
Add Article schema to your posts and WebSite schema to your homepage, validate both with the Rich Results Test, and keep the schema type matched to what’s actually on the page. Schema is one part of a broader SEO foundation — alongside your basic SEO setup and XML sitemap, it gives search engines a complete and accurate picture of your site. All of these technical SEO steps fit into the step-by-step guide to building a WordPress website alongside your content and structure decisions.

Etienne Basson works with website systems, SEO-driven site architecture, and technical implementation. He writes practical guides on building, structuring, and optimizing websites for long-term growth.