‘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

    • http://dazzaonline.com/ Darrel Andrews

      How do you do it using thesis?

  • Jean

    I have optimize press – what can I do?

  • http://johnjosephroberts.com/home/blog/ John Roberts

    Thank you so much Daniel. The message, “Error: Missing required field ‘updated’” is now gone because of your advice. From the comments, it looks like you are helping many other people to solve this problem. Great work!

  • Anita Suijkerbuijk

    Can someone help me with the same error Missing required field “updated” in wordpress theme Twenty Thirteen !!
    Several solutions on Google tried but nothing works for me. Even like this i can’t find the above text in de functions.php.
    Look at site http://www.google.nl/webmasters/tools/richsnippets?q=http%3A%2F%2Fwww.denkaanjezelf.nl%2F
    Can someone please help me ??
    Thx guys.

    • sarah

      Hi did you ever figure this out?

  • Amy Moeller

    Thanks so much. For some reason I couldn’t see your example – using a mac. I saw Christy’s comment, found where it said time class=”entry-date and added the word updated so it said time class=”entry-date updated It worked like a charm!

  • Kirk Neel

    I am new to wordpress and trying to figure this out. I get the same error I am using theme
    Parament.

  • http://www.cellunlock.net/ David Malka

    This worked perfectly! Now I need to figure how to fix the “This is not a verified publisher markup.”

  • Rahul Jain

    Hello, I have the same problem with my website http://www.rahulkcjain.com
    I could not find the given codes in my single.php file. I am using the tonic theme of WordPress and have been trying to fix this issue since a week now.
    it would be great if anyone of you can provide me a fix for the same. Also, I am a newbie to the coding world, so step by step instructions would be appreciated..
    thanks in advance..

  • http://www.techbymak.com/ TechByMak

    What about Blogger ?

  • Gilan Maria

    I am getting the rich snippets message “Warning: Missing required field “updated”"
    None of the fixes for twenty-eleven have worked.
    The I checked the source on one of my posts” Windows 8 You and Me Together”
    On line 194 is the HTML code ”
    And on 335 is the value “December 10, 2012 ”
    So the value “updated” is there but the Google snippets tool does not see it.
    Can anyone tell me where my problem is?

    - http://resultsway.com

  • Guest

    For twenty Thirteen :
    Add this in “function.php” in your child theme :

    if ( ! function_exists( ‘twentythirteen_entry_date’ ) ) :
    function twentythirteen_entry_date( $echo = true ) {
    if ( has_post_format( array( ‘chat’, ‘status’ ) ) )
    $format_prefix = _x( ‘%1$s on %2$s’, ’1: post format name. 2: date’, ‘twentythirteen’ );
    else
    $format_prefix = ‘%2$s’;
    $date = sprintf( ‘%4$s‘,
    esc_url( get_permalink() ),
    esc_attr( sprintf( __( ‘Permalink to %s’, ‘twentythirteen’ ), the_title_attribute( ‘echo=0′ ) ) ),
    esc_attr( get_the_date( ‘c’ ) ),
    esc_html( sprintf( $format_prefix, get_post_format_string( get_post_format() ), get_the_date() ) )
    );
    if ( $echo )
    echo $date;
    return $date;
    }
    endif;

    ?>

  • Time Education

    Dear i m using MH magazine Lite on my blog http://freenewsalert.com/ in default team has only date micro formats meta but i wanna add updated time of blog post . please tell me how can i do it without any mistake . thanks for support in advance

  • James

    I believe I followed the instructions properly. I created a functions.php file in the root directory of my 2011 child theme. And I added “updated” to the time tag. But the result is I get text at the top of my page when it loads…. any ideas?

  • James

    OK guys… fixed it. Thanks

  • http://wredlich.com/ny/ Warren Redlich

    Tried that just now on Twenty-Ten and it crashed the site. Hmm.

  • Cezar Cruz

    Thanks!! =D

  • Garazi Ibarrolaza

    I replaced the code but it doesn’t work for me :) What can I do?

  • Waldo Pulanco

    thanks! how about on blogspot like me i have the same error check out http://qneblog.blogspot.com
    i hope to resolve this problem to my blog!! thanks!

  • koolvick36

    please tell me how to fix this error