Hi there, after updating to Meta Box 5.2.6 i get the following error in my error logs for almost every page including images uploaded via custom field. In the front-end they show well though.
PHP message: PHP Warning: Invalid argument supplied for foreach() in /var/www/XXX/wp-content/plugins/meta-box/inc/fields/image.php on line 166
When I go back to Meta Box 5.2.4 everything works fine again. No error messages in the log files.
I use ShortPixel Image Optimizer for optimizing the images. As far as I know this plugin only has effect on uploading images. The only difference I see is this line in the 5.2.6. version which causes the error:
protected static function get_image_meta_data( $attachment_id ) {
$metadata = wp_get_attachment_metadata( $attachment_id );
$dir_url = dirname( wp_get_attachment_url( $attachment_id ) );
foreach ( $metadata['sizes'] as &$size ) {
$size['url'] = "{$dir_url}/{$size['file']}";
}
return $metadata;
}
In 5.2.4 this line isn't there at all. Any thoughts on how to fix this so i can use the newest version again?