Skip to content

Commit a0ed01d

Browse files
author
Michiel Verkoijen
committed
Add notice about wp_update_attachment_metadata.
1 parent 257edc7 commit a0ed01d

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

src/class-tiny-plugin.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,11 @@ public function compress_image_from_library() {
233233

234234
$tiny_image = new Tiny_Image( $id, $metadata );
235235
$result = $tiny_image->compress( $this->settings );
236+
237+
// The wp_update_attachment_metadata call is thrown because the
238+
// dimensions of the original image can change. This will then
239+
// trigger other plugins and can result in unexpected behaviour and
240+
// further changes to the image. This may require another approach.
236241
wp_update_attachment_metadata( $id, $tiny_image->get_wp_metadata() );
237242

238243
echo $this->render_compress_details( $tiny_image );
@@ -324,8 +329,8 @@ public function media_library_bulk_action() {
324329
check_admin_referer( 'bulk-media' );
325330

326331
if ( empty( $_REQUEST['action'] ) || (
327-
$_REQUEST['action'] != 'tiny_bulk_action' &&
328-
$_REQUEST['action2'] != 'tiny_bulk_action' ) ) {
332+
'tiny_bulk_action' != $_REQUEST['action'] &&
333+
'tiny_bulk_action' != $_REQUEST['action2'] ) ) {
329334
return;
330335
}
331336

0 commit comments

Comments
 (0)