WordPress Function add_theme_support( ‘html5’ ) was called incorrectly

An annoying message appeared yesterday when we migrated a customer website to a new server.

Notice: Function add_theme_support( ‘html5’ ) was called incorrectly. You need to pass an array of types.

The site is an older build but seemed to be working in every other respect. So a quick dive into the WordPress documentation for add_theme_support() confirmed that the old theme was using an old format of the add_theme_support function. Checking within the theme files identified the offending line and offered a quick fix.

// Add HTML5 markup structure
// 20230417 thowden : this format is incorrect. 
//add_theme_support( 'html5' );
// it should call with an array like this:
add_theme_support( 'html5', array( 'comment-list', 'comment-form', 'search-form', 'gallery', 'caption', 'style', 'script' ) );
// end thowden

The above modification was made and the site runs smoothly again. The actual details of the theme and the specific file are not relevant as this could affect any older WordPress theme install.

Leave a Comment