As previously mentioned in Updates to Image Processing in WordPress 5.3 and Introducing handling of big images in WordPress 5.3, there have been changes in image post-processing after upload.
In WordPress 5.3, the image metadata is saved after each intermediate size is created to allow the processing of images to happen over multiple requests. This means the wp_update_attachment_metadata
filter Filters are one of the two types of Hooks https://codex.wordpress.org/Plugin_API/Hooks. They provide a way for functions to modify data of other functions. They are the counterpart to Actions. Unlike Actions, filters are meant to work in an isolated manner, and should never have side effects such as affecting global variables and output. is run repeatedly while the image sub-sizes are being created. This fulfills the intended use of the filter, to let plugins “filter” the metadata before saving it to the database. It runs on all metadata updates, like when editing an attachment post, in wp_ajax_crop_image()
, or to update the ID3 data for audio files.
However, some plugins are using the wp_update_attachment_metadata
filter as an “upload is complete” hook (#48451). The changes in 5.3 are great for plugins that benefit from processing smaller amounts of information/images at a time, but may trigger more overhead/unneeded processing for plugins that bulk process images using that filter. A better hook to use for these cases is wp_generate_attachment_metadata
.
An alternative solution may be to add context (by adding another parameter) to the wp_update_attachment_metadata
filter.
The most likely plugins to be affected are those that use wp_update_attachment_metadata
to do additional post-processing of uploaded files. After a plugin A plugin is a piece of software containing a group of functions that can be added to a WordPress website. They can extend functionality or add new features to your WordPress websites. WordPress plugins are written in the PHP programming language and integrate seamlessly with WordPress. These can be free in the WordPress.org Plugin Directory https://wordpress.org/plugins/ or can be cost-based plugin from a third-party repo search, some examples of plugins that do this are Smush Image Compression and Optimization, WP Offload Media Lite for Amazon S3, DigitalOcean Spaces, and Google Cloud Storage, EWWW Image Optimizer, ShortPixel Image Optimizer, Compress JPEG & PNG images, Imagify – WebP & Image Compression and Optimization, a3 Lazy Load.
It would be ideal if the authors of potentially affected plugins could test and update them, if necessary, to continue working well in WordPress 5.3 or share any difficulties encountered on #48451.