As of WordPress 3.9, WordPress generates HTML5 Galleries if HTML5 is supported in the theme:

add_theme_support( 'html5' );

Originally in my theme development I did not declare HTML5 support and I've already published a few galleries which are using the old DT / DL HTML. Now I have declared HTML5 theme support as shown above, but WordPress won't regenerate my gallery even after saving the page or publishing a new gallery.

How do I "trick" WordPress or have WordPress start generating HTML5 galleries after my theme has been activate / activated?


Try this:

add_theme_support( 'html5', array( 'gallery', 'caption' ) );

And don't forget to declare the HTML5 DOCTYPE at the very beginning of header.php with:

<!DOCTYPE html>
| improve this answer | |
  • 1
    I guess I didn't read that WP 3.9 Gallery Article all the way through: "For forward compatibility reasons, the second argument with the specific parts can’t be omitted when registering support. Otherwise a theme would automatically declare its support for HTML5 features that might be added in the future, possibly breaking its visually because of it." -- Thanks! – Howdy_McGee Dec 4 '14 at 15:56

By Using

add_theme_support( $feature, $arguments ); 

Support for the gallery and caption


add_theme_support( 'html5', array('gallery', 'caption' ) );

Source: http://codex.wordpress.org/Function_Reference/add_theme_support

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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