How to Add Microdata to Posts in WordPress

microdata wordpress

Microdata makes it possible for search engines to understand important details about your site’s content.

Microdata provides Google and Bing with extra information about your content such as names, descriptions, dates and ratings. And, because search engines can understand your data more clearly, they often reward you with a higher ranking.

Some themes provide microdata support, but many do not. In this tutorial, I’m going to show you how to add microdata to your WordPress theme.

Step #1. Check if your theme uses microdata

First, let’s check to see if your theme is using microdata.

  • Go to this URL.
  • Paste in the URL of one of your site’s posts.
  • Click the “Fetch Validate” button.

This image shows a theme that uses metadata correctly:


If you see an image like the one below, your theme is using metadata, but has errors. Check with your theme provider for a fix.

How to Add Microdata to Articles in Joomla 3

If you don’t see any results like these, your theme doesn’t use metadata. Keep reading this tutorial to know how to add it.

Step #2. Set schema

We’re going to use the schema for articles from There are other options for product, review, book, etc. depending on your site.

The way to add microdata to WordPress is by using a child theme. The child theme allows you to keep the customisations safe in case the original is updated in future.

Copy the necessary files from the parent into the child theme. The specific files you need depends on the theme. Every theme developer organize the files in different ways.

You can copy the files manually or by using the Child Theme Configurator plugin:

  • Tools > Child Themes > Files.
  • Select the files that render the single post.
  • Copy Selected to Child Theme.
  • In the duplicated file, look for the div that works as the container for the post.
  • Add itemscope itemtype=”” into the div, like this:
<div id="post-container" itemscope itemtype="">

Step #3. Add article markup properties

Look carefully inside the child theme files to see where to add support for each property. For example, we’re going to add itemprop=”name” to the post title and we’re going to add itemprop=”datePublished” to the publication date.


<h2 itemprop="name">Post title</h2>


<a href="/post/url/" itemprop="url">Post title</a>


<span itemprop="genre">Category title</span>


<a href="/link/to/post/" itemprop="genre">Category title</a>


<time datetime="2015-08-06T00:26:57-05:00" itemprop="datePublished">06 August 2015</time>


<div itemprop="articleBody">Post full text.</div>


<span itemprop="author" itemscope itemtype="">
<span itemprop="name">Author name</span>


<h2 itemprop="headline">Post headline</h2>


<img itemprop="image" src="path/to/image.jpg" alt=""/>

Note: wrapping elements such as the category or date may require adding a span tag with the “itemprop” attribute.

For example:

<span itemprop="genre"><?php the_category(', '); ?></span>

Step #4. Test the end result

Go back to Step #1 and test your site again. Hopefully Google’s test now shows that your microdata is working correctly.


  • Valentin Garcia

    Valentin discovered Joomla in 2010, and since then he has considered it as the best CMS. Valentin has been coding extensions and templates for Joomla for many years and truly enjoys helping people build their own websites with Open Source tools. He lives in San Julián, Jalisco, México.

    View all posts
0 0 votes
Article Rating
Notify of

1 Comment
Newest Most Voted
Inline Feedbacks
View all comments
Darshan Saroya
Darshan Saroya
6 years ago

Is adding Schema microdata post is enough or other post type is also required?

Would love your thoughts, please comment.x