WordPress 5.8 media library changes you should know about – WP Tavern



It’s hard not to go through a list of upcoming WordPress 5.8 changes and find at least a little something to whet your appetite. With so many improvements to come, even we haven’t been able to keep up with them all here at WP Tavern. The next release will bring some much-needed media-related upgrades.

Users should take advantage of WebP image format support and a copy to clipboard button on the media download screen. The developers have a new hook to filter the output format of the image, and the platform is ditching infinite scrolling.

WordPress 5.8 is slated for July 20, so these changes will arrive in less than a week. If you haven’t already, test WordPress 5.8 Release Candidate 3 and report any issues.

Infinite scrolling replaced by Ajax button

The next major release will ditch infinite scrolling for media in favor of an Ajax powered “Load More” button. The admin screen and editor media overlay will limit the initial and subsequent “pages” to 40 media each.

This change is part of an effort by the WordPress Accessibility Team to improve the end-user experience. Team member and main contributor Andrea Fercia noted two persistent issues with infinite scrolling. The first is that it is almost impossible for keyboard users to access content appended to the screen. Second, there is no audible feedback or instructions on how infinite scrolling works for screen readers.

He also noted usage and performance issues. Infinite scrolling can break browser history and there is no JavaScript fallback. And loading hundreds or more of large images increases the memory footprint.

As the Media Library receives Ajax processing in WordPress 5.8, we should expect similar updates for other areas in the future, including:

  • Add Themes Screen
  • Customizer> Add menu items
  • Editor> Link> Search

Copy URL from Add New Media screen

Copy URL to Clipboard button on the Add New Media screen.

This change is an improvement that rids the platform of a minor but noticeable nuisance that has plagued it for years. When uploading an image from the Media> Add New screen in the WordPress admin, there was no way to retrieve its URL without clicking on the edit screen.

WordPress 5.8 introduces a “Copy URL to Clipboard” button that appears after uploading the image. No need to leave the page and search for the URL. The change also makes the user experience consistent with the media library screen and the overlay in the post editor.

Most often, browsing Trac means seeing several identical names. This time around, it looks like a regular user wanted a feature. They created an account – maybe just for this purpose -, wrote a post on the support forum, were directed to Trac, and created their first ticket. It took eight months to make its way through WordPress, but this is one of those success stories of an average user who gets the ball rolling by just providing comments. Thanks for the contribution, @anotia.

Support for WebP image format

WordPress allows a new image format. And, no, it’s not SVG (technically not an image). There are still some security hurdles to overcome for this to ever happen. However, it now supports WebP, which carries with it the promise of better performance for those who use it.

As Sarah Gooding reported for WP Tavern last month:

This modern image file format was created by Google in September 2010 and is now supported by 95% of web browsers in use around the world. It has distinct advantages over the more commonly used formats, offering both lossless and lossy compression that is 26% smaller compared to PNGs and 25-34% smaller than comparable JPEG images.

In the report, she noted that only 1.6% (currently at 1.8%) of the top 10 million websites were using the WebP format. With WordPress now adding support, this percentage is likely to increase in the coming years.

Developers: Image editor output format hook

For developers who want to transform images from one mime type to another, 5.8 introduces the image_editor_output_format filter hook. Plugin authors can convert all newly uploaded images or overwrite only specific formats.

The following example converts JPG images to the new WebP format:

add_filter( 'image_editor_output_format', function( $formats ) {
        $formats['image/jpg'] = 'image/webp';

        return $formats;
} );

The output format will be applied to all image sub-sizes as they are created. However, this will only work for WebP images if the web server supports it.


Leave A Reply

Your email address will not be published.