Upon closer examination of the output, all of the elements that did not have explicit closing tags were missing the self-closing notation i.e. <content ... />
;
For some reason the functions.php
file had these functions to “clean up” the output for HTML5:
/**********************************************
REMOVE SELF-CLOSING TAGS && USER-HARDCODED TAGS
***********************************************/
if ( !is_admin() && ( ! defined('DOING_AJAX') || ( defined('DOING_AJAX') && ! DOING_AJAX ) ) ) {
ob_start( 'html5_slash_fixer' );
add_action( 'shutdown', 'html5_slash_fixer_flush' );
}
function html5_slash_fixer( $buffer ) {
$buffer = str_replace( '<p id="top" />', null, $buffer );
$buffer = str_replace( ' />', '>', $buffer );
return $buffer;
}
function html5_slash_fixer_flush() {
ob_end_flush();
}
So I added a check in the html5_slash_fixer
method to determine if the current query is for a feed: is_feed (WordPress Codex)
function html5_slash_fixer( $buffer ) {
$buffer = str_replace( '<p id="top" />', null, $buffer );
if( !is_feed() ){
$buffer = str_replace( ' />', '>', $buffer );
}
return $buffer;
}
With this fix, the output validates with warnings only.