New Core Gallery Widget Targeted for WordPress 4.9

The Core Media Widgets feature plugin introduced a gallery widget in the 0.2.0 release this week. WordPress 4.8 added the new audio, image, and video widgets from this feature plugin. The gallery widget is targeted for merge into the upcoming WordPress 4.9 release.

In testing the new feature I found it to be a simple, straightforward implementation of a gallery widget that could easily replace many plugins that are currently filling this need for users. The option to edit or replace a gallery is immediately available and users can easily rearrange or randomize the images included.

On the frontend the gallery displays neatly in a thumbnail grid. I was able to change the number of columns while editing the gallery, but the preview in the admin did not match the the way the gallery looks on the frontend. The number of columns is correct on the frontend but not in the admin preview. This might cause some confusion for users if it isn’t fixed before landing in core. Contributors to the plugin are looking at this issue.

Overall, the implementation is user-friendly and similar to adding galleries in posts and pages. However, the widget could still use some testing, especially with different plugins installed. For example, with Jetpack enabled, users can choose between a thumbnail and a slideshow gallery, but the slideshow option doesn’t seem to work correctly in the widget. has several hundred plugins that implement some sort of gallery widget and these plugin authors will want to test the new core widget.

Theme authors will also need to test how the core gallery widget interacts with their themes. After testing the gallery widget with several popular themes, I found that many display the thumbnails with unsightly outlines and unpredictable spacing between images.

Weston Ruter, who authored the dev note post when the previous media widgets were introduced in 4.8, said that the paragraph regarding default theme updates is still applicable:

Themes that add custom styles to the MediaElement.js player (namely Twenty Thirteen and Twenty Fourteen) were updated from just styling it within syndicated content, to also include instances within widgets. Most themes don’t restrict styles for captioned images or media players to just post content, that is, limit CSS selectors to classes output by post_class(). If your theme does, make sure to either remove that constraint or include a .widget selector.

Ruter said another dev note will be coming with common theme changes that are required to add the right styling for galleries. Users and theme/plugin developers can test the gallery widget right now on 4.8.2 or 4.9-alpha using the Core Media Widgets plugin. Once the widget is added to WordPress, it will be deactivated in the feature plugin for future releases. Contributors plan to merge the new widget into core next week, provided testing goes well.


10 responses to “New Core Gallery Widget Targeted for WordPress 4.9”

    • Widgets aren’t being deprecated yet. In any case, when widgets do transition over to blocks, there is a gallery block in Gutenberg for the gallery widget to transition to. In the same way, a Custom HTML widget was introduced in 4.8.1 and there is a Custom HTML block in Gutenberg. When widgets do transition over to using blocks, users shouldn’t actually perceive any fundamental change in this regard: they’ll continue being able to use images, video, audio, galleries, custom HTML and other widgets in their sidebars as well as being able to use such widgets (blocks) for the first time in the content of their posts as well.

  1. There are two important aspects that should be addressed and, of course, implemented within gallery widget while in slideshow/lightbox mode:
    Deeplink to each image and set the necessary Open Graph Protocol’s tags in order to ensure that the image that appears on the shared post will be the same the user wanted to share inside the slideshow.

  2. More great work from the Customization team. I think it’s really great how they’ve taken a user-first approach to improvements this year. Just because Gutenberg is on the horizon doesn’t mean we shouldn’t take the opportunity to make existing and new user’s lives easier today.


Subscribe Via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

%d bloggers like this: