Fixing the ‘Missing required field “updated”‘ error in WordPress TwentyTen theme

When exploring my hobby website in Google WebMaster tools I noticed that all WordPress posts had the same ‘Missing required field “updated”‘ error. After some searching I understood that the proper solution would be to use a child theme (which I already had since I wanted to change the default font of the TwentyTen theme) and I need to change the way the posted date is shown so that it also indicates to Google that it is the update date.

Finally I have figured it out. You have to create a child theme if you don’t have one. Just a folder under /your_site/wp-content/themes/ would do. Any name would do. You need to create a style.css with necessary meta-info so that it becomes a recognized theme and perhaps a .png image if you want to have it fancy (I don’t).

Finally, for the twentyten theme you need to update the twentyten_posted_on function defined in the functions.php. So you create a new functions.php and put the following code in there:

 * TwentyTen custom functions and definitions

/* Provides fix for the 'Missing required field "updated"' error */
function twentyten_posted_on() {
    printf( __( '<span class="%1$s">Posted on</span> %2$s <span class="meta-sep">by</span> %3$s', 'twentyten' ),
        'meta-prep meta-prep-author',
        sprintf( '<a href="%1$s" title="%2$s" rel="bookmark"><span class="entry-date updated">%3$s</span></a>',
            esc_attr( get_the_time() ),
        sprintf( '<span class="author vcard"><a class="url fn n" href="%1$s" title="%2$s">%3$s</a></span>',
            get_author_posts_url( get_the_author_meta( 'ID' ) ),
            esc_attr( sprintf( __( 'View all posts by %s', 'twentyten' ), get_the_author() ) ),

The trick is in the line 11, which adds the “updated” class to the list, so that

<span class="entry-date">


<span class="entry-date updated">

How difficult was that?


More information on child themes on WordPress site.