This tutorial has been updated for WordPress’ new default theme, Twenty Twelve. Reference this tutorial to fix this SEO issue if you’re using the Twenty Twelve theme.
If Google’s Structured Data Testing Tool reports the error ‘Warning: Missing required field “updated”‘, your Twenty Eleven WordPress theme is likely missing the “updated” microformat. This information is used by Google to include the publication date of your blog posts in Rich Snippet search results and is important for SEO. We found that WordPress’ Twenty Eleven theme does not properly identify this data, but we have a quick fix.

As with all code modifications, we advise that you take a backup prior to editing any files. In /wp-content/themes/twentyeleven/functions.php, locate the function in the following line:
580 | function twentyeleven_posted_on() |
This function provides an HTML output of meta information relevant to the post. On the next line, find the “time” tag and add an additional CSS class called “updated”. Here is the change we just made on line 581 in context:
580 581 582 583 584 585 586 587 588 589 590 | function twentyeleven_posted_on() { printf( __( '<span class="sep">Posted on </span><a href="%1$s" title="%2$s" rel="bookmark"><time class="entry-date updated" datetime="%3$s" pubdate="">%4$s</time></a><span class="by-author"> <span class="sep"> by </span> <span class="author vcard"><a class="url fn n" title="%6$s" href="%5$s" rel="author">%7$s</a></span></span>', 'twentyeleven' ), esc_url( get_permalink() ), esc_attr( get_the_time() ), esc_attr( get_the_date( 'c' ) ), esc_html( get_the_date() ), esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ), esc_attr( sprintf( __( 'View all posts by %s', 'twentyeleven' ), get_the_author() ) ), get_the_author() ); } |
If your blog uses Twenty Eleven as its parent theme, copy the above function to functions.php in the root directory of your child theme. If the file does not exist, create it with the code below:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | <?php function twentyeleven_posted_on() { printf( __( '<span class="sep">Posted on </span><a href="%1$s" title="%2$s" rel="bookmark"><time class="entry-date updated" datetime="%3$s" pubdate>%4$s</time></a><span class="by-author"> <span class="sep"> by </span> <span class="author vcard"><a class="url fn n" href="%5$s" title="%6$s" rel="author">%7$s</a></span></span>', 'twentyeleven' ), esc_url( get_permalink() ), esc_attr( get_the_time() ), esc_attr( get_the_date( 'c' ) ), esc_html( get_the_date() ), esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ), esc_attr( sprintf( __( 'View all posts by %s', 'twentyeleven' ), get_the_author() ) ), get_the_author() ); } ?> |
Now when you validate your microdata in Google Webmaster Tools, you should no longer see ‘Warning: Missing required field “updated”‘. Let us know in the comments if this worked for you or if you encountered any issues.





