‘Warning: Missing required field “updated”‘ in WordPress Twenty Eleven theme

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.

Warning: Missing required field "updated" with Twenty Eleven WordPress theme

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.

  • http://www.technosultants.com/ Daniel Marquard

    Just a side note, your function may differ slightly from the one in the post as a result of small changes across different versions of the Twenty Eleven theme. As long as you update only ”, you should be fine.

    • Christy Russell

      I’m using Twenty Eleven Version 1.3, have made the simple one word edit which you recommend – time class=”entry-date updated” – and yet I have Warning: Missing required field “updated” error. Any ideas? Thank you very much. This is my page: http://doulanurse.com/

      • http://www.technosultants.com/ Daniel Marquard

        Hi Christy. I just had a look at your website and it appears that your WordPress template is missing a number of standard microformats that Google is looking for, not just the publication date.

        We’d be happy to fix these for you. Feel free to get in touch with me at daniel {at} technosultants.com. Thanks!

  • http://njnnetwork.com/ Stephen Pate

    Thanks for the code. I just entered the time code “%4$s”

    The references in “a href=”%5$s” title=”%6$s” are reversed href/title but I left mine as is since it works.
    The error is gone…thanks again.

    • http://www.technosultants.com/ Daniel Marquard

      Glad it worked! WordPress somehow shuffled some of those attributes, but they will work in any order. Thanks for letting me know.

    • Ed Allan

      could you please advice me too solve the same issue.
      sprintf( ‘%3$s‘, Still I do have the error. Please help.

      • http://www.technosultants.com/ Daniel Marquard

        Hi Ed. For this fix, simply replace “entry-date” with “entry-date updated”. If you experience any issues, you can always restore from a backup.

        • Ed Allan

          Hi Daniel,

          Thank you, I have done the same, but error is same.

          sprintf( ‘%3$s’,

        • Ed Allan

          span class=”entry-date updated”>%3$s</span

        • http://www.technosultants.com/ Daniel Marquard

          Are you sure that’s the error you’re seeing when you load your blog? The simplest fix for this would be for you to revert to a backup of functions.php and attempt to add the additional “updated” class again. This change should not cause any on-screen errors.

        • Ed Allan

          Could you please click on this link, you will see the error.
          Apologize for the inconvenient. Thank you for the help.

        • http://www.technosultants.com/ Daniel Marquard

          Your website has very few microformats. Are you using either the Twenty Eleven or Twenty Twelve WordPress theme? Your theme would require tags citing the SEO data, such as the below HTML from this page:

          <a href="http://www.technosultants.com/blog/warning-missing-required-field-updated-wordpress&quot; title="8:56 pm" rel="bookmark"><time class="entry-date updated" datetime="2012-12-10T20:56:35-05:00" pubdate>December 10, 2012</time></a>

        • Ed Allan

          Daniel,
          It’s Twenty_Ten

        • http://www.technosultants.com/ Daniel Marquard

          Technosultants only supports Twenty Eleven and Twenty Twelve, mainly for this reason; SEO is subpar in Twenty Ten. We are using a simplified version of Twenty Eleven on this blog and we find that it suffices our SEO needs. If you’re not able to upgrade your WordPress theme, feel free to take a look at the HTML for this page to identify the microformats used my Google.

          If you’d like me to add all of the modern microformats to your existing theme, please send me an email and I’ll be happy to assist. daniel {at} technosultants.com

        • Ed Allan

          Thank you Daniel, I just sent you a mail.

  • wineybrett

    Thank you for explaining this code improvement – it worked for me!

    • http://www.technosultants.com/ Daniel Marquard

      You’re quite welcome! Glad it helped.

  • Min Min

    Magic

  • Pete Jett

    This was just what I was looking for. Worked like a charm. Thanks!

  • Rita

    Help me please.., I already change in the line 581 and the error is gone but the rich snippet is gone too not showed. What should I do ?

  • Gyle Martinda

    nice I get success with your tips. I was get problem on my website http://aen24.com with thesis theme. With your introduction i get success… thanks for sharing