WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When the calendar widget is activated in the sidebar, it generates the following validation error (W3C markup validation):

The summary attribute is obsolete. Consider describing the structure of the table in a caption element or in a figure element containing the table; or, simplify the structure of the table so that no description is needed.

…alendar</h3><div id="calendar_wrap"><table id="wp-calendar"

How can I rectify this without messing with any core file?

Working with WP3.1.4, twentyten theme.


share|improve this question
up vote 0 down vote accepted

Update to 3.2.2. The summary attribute has been removed. See line 1149 \wp-includes\general-template.php

WP v3.1.4:

$calendar_output = '<table id="wp-calendar" summary="' . esc_attr__('Calendar') . '">

WP v3.2.2:

$calendar_output = '<table id="wp-calendar">

Alternatives... To modify the output of the widget, you can duplicate it and rename it. When I did that, I also needed to duplicate the get_calendar() function and adjust the calls to apply_filters() and the caching functions. It was worth the work, because I wanted complete control of the calendar widget's output.

Another approach is to use the get_calendar filter and modify the output using str_replace, simple xml, regex, etc. Here's a solution using str_replace() (add this code to functions.php):

add_filter( 'get_calendar', 'customize_calendar_output' );
function customize_calendar_output( $calendar_output ) {
    $calendar_output = str_replace( '<table id="wp-calendar" summary="' . esc_attr__('Calendar') . '">', '<table id="wp-calendar">', $calendar_output );
    return $calendar_output;
share|improve this answer
thanks for time and help. I prefer the Alternatives you mentioned, but I don get it. can you peovide more info please. thanks. – Tara Oct 10 '11 at 3:01
10 continuing with my above comment, how can I filter $calendar_output = '<table id="wp-calendar" summary="' . esc_attr__('Calendar') . '"> to $calendar_output = '<table id="wp-calendar"> – Tara Oct 10 '11 at 3:33
Updating WP is the best way for sure, but I've updated my answer with a solution using the get_calender filter. – goto10 Oct 10 '11 at 4:23
10, sorry I spoke to soon, the filter did not resolve the error – Tara Oct 10 '11 at 15:29
I tested it before I posted the code. It worked. Please give more details or show your code. If you do: add_filter( 'calendar_output', 'customize_calendar_output' ); function customize_calendar_output( $calendar_output ) { $calendar_output = '<h1>TEST TEST TEST</h1>' . $calendar_output; return $calendar_output; } does the h1 show up? – goto10 Oct 10 '11 at 17:41

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.