From 31d865271bb3eafbe7db63ab29005856057577a0 Mon Sep 17 00:00:00 2001 From: Andrew Ozz Date: Sat, 15 Jun 2019 17:16:27 +0000 Subject: [PATCH] Media: fix support for arrays for the `crop` setting for registered image sub-sizes in `wp_get_registered_image_subsizes()`. See #40439. git-svn-id: https://develop.svn.wordpress.org/trunk@45541 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/media.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/wp-includes/media.php b/src/wp-includes/media.php index e1180c28f0..30fadcbeb4 100644 --- a/src/wp-includes/media.php +++ b/src/wp-includes/media.php @@ -864,9 +864,13 @@ function wp_get_registered_image_subsizes() { } if ( isset( $additional_sizes[ $size_name ]['crop'] ) ) { - $size_data['crop'] = (bool) $additional_sizes[ $size_name ]['crop']; + $size_data['crop'] = $additional_sizes[ $size_name ]['crop']; } else { - $size_data['crop'] = (bool) get_option( "{$size_name}_crop" ); + $size_data['crop'] = get_option( "{$size_name}_crop" ); + } + + if ( ! is_array( $size_data['crop'] ) || empty( $size_data['crop'] ) ) { + $size_data['crop'] = (bool) $size_data['crop']; } $all_sizes[ $size_name ] = $size_data;